--- name: "Test Tree-sitter Grammar" description: "Runs comprehensive grammar tests including parser validation" inputs: skip-sample-test: description: "Skip the sample ShellSpec code test" required: false default: "false" runs: using: "composite" steps: - name: Run Tests run: npm test shell: bash - name: Build Parser run: npm run build shell: bash - name: Test Parser with Sample Code if: inputs.skip-sample-test != 'true' run: | cat << 'EOF' > test_sample.shellspec #!/usr/bin/env shellspec Describe 'Calculator' Include ./lib/calculator.sh Before 'setup_calculator' After 'cleanup_calculator' Context 'when adding numbers' It 'adds two positive numbers' When call add 2 3 The output should eq 5 End It 'handles zero' When call add 0 5 The output should eq 5 End End Context 'when input is invalid' Skip if "validation not implemented" ! command -v validate It 'handles empty input' When call add "" "" The status should be failure End End End It 'works without describe block' When call echo "test" The output should eq "test" End EOF tree-sitter parse test_sample.shellspec --quiet || { echo "❌ Parser failed on sample ShellSpec code" exit 1 } echo "✅ Parser successfully handled sample code" shell: bash - name: Validate Parser (Simple) if: inputs.skip-sample-test == 'true' run: | echo "Describe 'test' It 'works' End End" | tree-sitter parse --language=shellspec || { echo "❌ Parser validation failed" exit 1 } echo "✅ Parser validation successful" shell: bash