mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-07 21:49:33 +00:00
feat: implement complete tree-sitter-shellspec grammar with comprehensive testing
- 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
This commit is contained in:
219
test/corpus/hook_blocks.txt
Normal file
219
test/corpus/hook_blocks.txt
Normal file
@@ -0,0 +1,219 @@
|
||||
================================================================================
|
||||
BeforeEach hook
|
||||
================================================================================
|
||||
|
||||
BeforeEach
|
||||
setup_environment
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
BeforeEach with label
|
||||
================================================================================
|
||||
|
||||
BeforeEach "setup database"
|
||||
init_database
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
AfterEach hook
|
||||
================================================================================
|
||||
|
||||
AfterEach
|
||||
cleanup_environment
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
AfterEach with label
|
||||
================================================================================
|
||||
|
||||
AfterEach "cleanup database"
|
||||
cleanup_database
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
BeforeAll hook
|
||||
================================================================================
|
||||
|
||||
BeforeAll
|
||||
global_setup
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
BeforeAll with raw string label
|
||||
================================================================================
|
||||
|
||||
BeforeAll 'global setup'
|
||||
global_setup
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(raw_string)))
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
AfterAll hook
|
||||
================================================================================
|
||||
|
||||
AfterAll
|
||||
global_cleanup
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
BeforeCall hook
|
||||
================================================================================
|
||||
|
||||
BeforeCall
|
||||
prepare_call
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
AfterCall hook
|
||||
================================================================================
|
||||
|
||||
AfterCall
|
||||
verify_call
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
BeforeRun hook
|
||||
================================================================================
|
||||
|
||||
BeforeRun
|
||||
prepare_run
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
AfterRun hook
|
||||
================================================================================
|
||||
|
||||
AfterRun
|
||||
verify_run
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
Hook with multiple statements
|
||||
================================================================================
|
||||
|
||||
BeforeEach "complex setup"
|
||||
export TEST_VAR="value"
|
||||
mkdir -p /tmp/test
|
||||
touch /tmp/test/file
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_hook_block
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(declaration_command
|
||||
(variable_assignment
|
||||
name: (variable_name)
|
||||
value: (string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(word))
|
||||
argument: (word)
|
||||
argument: (word))
|
||||
(command
|
||||
name: (command_name
|
||||
(word))
|
||||
argument: (word))))
|
||||
Reference in New Issue
Block a user