Files
cs249r_book/tools/scripts/test_lua_error.sh
Vijay Janapa Reddi 14c37b846b Add pre-commit part key validation system
- Add validate-part-keys hook to .pre-commit-config.yaml
- Create validate_part_keys.py script for comprehensive validation
- Enhance inject-parts.lua with better error handling and pre-scan
- Add documentation for part key validation system
- Remove validation from GitHub workflow (moved to pre-commit)
- Add utility scripts for key checking and build cleanup

This catches invalid part keys before commit rather than in CI/CD
2025-07-31 01:35:46 -04:00

37 lines
971 B
Bash
Executable File

#!/bin/bash
# Test Lua Error Handling Script
# This script tests the inject-parts.lua error handling
echo "🧪 Testing Lua error handling..."
# Create a temporary test file with an invalid key
cat > test_invalid_key.qmd << 'EOF'
---
title: "Test Invalid Key"
format: pdf
---
# Test
\part{key:invalid_key}
Content here.
EOF
echo "📄 Created test file with invalid key 'invalid_key'"
# Try to render the test file
echo "🔨 Attempting to render test file..."
if quarto render test_invalid_key.qmd --to pdf 2>&1 | grep -q "CRITICAL ERROR"; then
echo "✅ Error handling working correctly - build stopped as expected"
echo "📋 Error output:"
quarto render test_invalid_key.qmd --to pdf 2>&1 | grep -A 10 "CRITICAL ERROR"
else
echo "❌ Error handling not working - build continued unexpectedly"
quarto render test_invalid_key.qmd --to pdf 2>&1
fi
# Clean up
rm -f test_invalid_key.qmd test_invalid_key.pdf
echo "🧹 Cleaned up test files"