#!/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"