mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-10 21:50:47 +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:
258
test/corpus/utility_blocks.txt
Normal file
258
test/corpus/utility_blocks.txt
Normal file
@@ -0,0 +1,258 @@
|
||||
================================================================================
|
||||
Data block
|
||||
================================================================================
|
||||
|
||||
Data
|
||||
item1
|
||||
item2
|
||||
item3
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_data_block
|
||||
statements: (command
|
||||
name: (command_name
|
||||
(word)))
|
||||
statements: (command
|
||||
name: (command_name
|
||||
(word)))
|
||||
statements: (command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
Data block with label
|
||||
================================================================================
|
||||
|
||||
Data "test data"
|
||||
"value 1"
|
||||
"value 2"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_data_block
|
||||
statements: (command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
statements: (command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
statements: (command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))))
|
||||
|
||||
================================================================================
|
||||
Parameters block
|
||||
================================================================================
|
||||
|
||||
Parameters
|
||||
param1
|
||||
param2
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))
|
||||
(command
|
||||
name: (command_name
|
||||
(word)))))
|
||||
|
||||
================================================================================
|
||||
Parameters with label
|
||||
================================================================================
|
||||
|
||||
Parameters "test parameters"
|
||||
"first param"
|
||||
"second param"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))))
|
||||
|
||||
================================================================================
|
||||
Skip block
|
||||
================================================================================
|
||||
|
||||
Skip
|
||||
echo "this is skipped"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
label: (word)
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))))
|
||||
|
||||
================================================================================
|
||||
Skip with reason
|
||||
================================================================================
|
||||
|
||||
Skip "not implemented yet"
|
||||
echo "this test"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(word))
|
||||
argument: (string
|
||||
(string_content)))))
|
||||
|
||||
================================================================================
|
||||
Pending block
|
||||
================================================================================
|
||||
|
||||
Pending
|
||||
echo "pending implementation"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
label: (word)
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))))
|
||||
|
||||
================================================================================
|
||||
Pending with reason
|
||||
================================================================================
|
||||
|
||||
Pending "waiting for fix"
|
||||
echo "test"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(word))
|
||||
argument: (string
|
||||
(string_content)))))
|
||||
|
||||
================================================================================
|
||||
Todo block
|
||||
================================================================================
|
||||
|
||||
Todo
|
||||
echo "todo item"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
label: (word)
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))))
|
||||
|
||||
================================================================================
|
||||
Todo with description
|
||||
================================================================================
|
||||
|
||||
Todo "implement feature X"
|
||||
echo "feature X"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_utility_block
|
||||
(command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))
|
||||
(command
|
||||
name: (command_name
|
||||
(word))
|
||||
argument: (string
|
||||
(string_content)))))
|
||||
|
||||
================================================================================
|
||||
Empty utility block
|
||||
================================================================================
|
||||
|
||||
Data "empty data"
|
||||
End
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_data_block
|
||||
statements: (command
|
||||
name: (command_name
|
||||
(string
|
||||
(string_content))))))
|
||||
|
||||
|
||||
|
||||
================================================================================
|
||||
Data string argument style
|
||||
================================================================================
|
||||
|
||||
Data "inline data"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_data_block
|
||||
argument: (string
|
||||
(string_content))))
|
||||
|
||||
================================================================================
|
||||
Data function argument style
|
||||
================================================================================
|
||||
|
||||
Data get_test_data
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(program
|
||||
(shellspec_data_block
|
||||
argument: (word)))
|
||||
Reference in New Issue
Block a user