mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-01-26 11:43:59 +00:00
- Add full ShellSpec grammar extending tree-sitter-bash - Support all ShellSpec constructs: Describe, Context, It, hooks, utilities - Include Data block parsing with statements and argument styles - Add 61 comprehensive test cases covering real-world patterns - Implement optimized GitHub workflows with CI/CD automation - Configure complete development tooling (linting, formatting, pre-commit) - Add comprehensive documentation and contribution guidelines - Optimize grammar conflicts to zero warnings - Support editor integration for Neovim, VS Code, Emacs Breaking Changes: - Initial release, no previous API to break BREAKING CHANGE: Initial implementation of tree-sitter-shellspec grammar # Conflicts: # .github/workflows/codeql.yml # .github/workflows/pr-lint.yml # .pre-commit-config.yaml # Conflicts: # .github/workflows/pr-lint.yml # Conflicts: # .github/workflows/pr-lint.yml
78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
---
|
|
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
|