mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-21 07:54:37 +00:00
fix: apply CodeRabbit nitpick suggestions and improve code quality
- Fix grammar.js TypeScript errors by correcting optional field usage - Update .yamlignore to use more robust glob pattern (**/node_modules/**) - Remove hard-coded test count from README.md for maintainability - Fix shellcheck directive format (add space after #) in all test specs - Fix typos throughout test specifications: - 'can not' → 'cannot' - 'expantion' → 'expansion' - 'singnal' → 'signal' - 'It mean' → 'It means' - Update CODE_OF_CONDUCT.md HTTP links to HTTPS - Update tree-sitter parse command to use --scope instead of --language - Add comments to .mega-linter.yml explaining disabled linters All grammar tests still pass (61/61) and the parser functions correctly with the updated tree-sitter CLI v0.25.0.
This commit is contained in:
@@ -1,85 +1,85 @@
|
||||
#shellcheck shell=sh disable=SC2016
|
||||
# shellcheck shell=sh disable=SC2016
|
||||
|
||||
# Data helper is easy way to input data from stdin for evaluation.
|
||||
# Removes `#|` from the beginning of the each line in the Data helper,
|
||||
# the rest is the input data.
|
||||
|
||||
Describe 'Data helper'
|
||||
Example 'provide with Data helper block style'
|
||||
Data
|
||||
#|item1 123
|
||||
#|item2 456
|
||||
#|item3 789
|
||||
End
|
||||
When call awk '{total+=$2} END{print total}'
|
||||
The output should eq 1368
|
||||
End
|
||||
|
||||
Example 'provide string with Data helper'
|
||||
Data '123 + 456 + 789'
|
||||
When call bc
|
||||
The output should eq 1368
|
||||
End
|
||||
|
||||
Example 'provide from function with Data helper'
|
||||
data() {
|
||||
echo item1 123
|
||||
echo item2 456
|
||||
echo item3 789
|
||||
}
|
||||
Data data
|
||||
When call awk '{total+=$2} END{print total}'
|
||||
The output should eq 1368
|
||||
End
|
||||
|
||||
Describe 'Data helper with filter'
|
||||
Example 'from block'
|
||||
Data | tr 'abc' 'ABC'
|
||||
#|aaa
|
||||
#|bbb
|
||||
End
|
||||
|
||||
When call cat -
|
||||
The first line of output should eq 'AAA'
|
||||
The second line of output should eq 'BBB'
|
||||
End
|
||||
|
||||
Example 'from function'
|
||||
foo() { printf '%s\n' "$@"; }
|
||||
Data foo a b c | tr 'abc' 'ABC' # comment
|
||||
When call cat -
|
||||
The first line of output should eq 'A'
|
||||
The second line of output should eq 'B'
|
||||
The third line of output should eq "C"
|
||||
The lines of entire output should eq 3
|
||||
End
|
||||
|
||||
Example 'from string'
|
||||
Data 'abc'| tr 'abc' 'ABC' # comment
|
||||
When call cat -
|
||||
The output should eq ABC
|
||||
End
|
||||
End
|
||||
|
||||
Describe 'variable expansion'
|
||||
Before 'item=123'
|
||||
|
||||
Example 'not expand variable (default)'
|
||||
Data:raw
|
||||
#|item $item
|
||||
End
|
||||
When call cat -
|
||||
The output should eq 'item $item'
|
||||
End
|
||||
|
||||
Example 'expand variable'
|
||||
Data:expand
|
||||
#|item $item
|
||||
End
|
||||
When call cat -
|
||||
The output should eq 'item 123'
|
||||
End
|
||||
|
||||
# variable expansion is supported by block style only.
|
||||
End
|
||||
Example 'provide with Data helper block style'
|
||||
Data
|
||||
#|item1 123
|
||||
#|item2 456
|
||||
#|item3 789
|
||||
End
|
||||
When call awk '{total+=$2} END{print total}'
|
||||
The output should eq 1368
|
||||
End
|
||||
|
||||
Example 'provide string with Data helper'
|
||||
Data '123 + 456 + 789'
|
||||
When call bc
|
||||
The output should eq 1368
|
||||
End
|
||||
|
||||
Example 'provide from function with Data helper'
|
||||
data() {
|
||||
echo item1 123
|
||||
echo item2 456
|
||||
echo item3 789
|
||||
}
|
||||
Data data
|
||||
When call awk '{total+=$2} END{print total}'
|
||||
The output should eq 1368
|
||||
End
|
||||
|
||||
Describe 'Data helper with filter'
|
||||
Example 'from block'
|
||||
Data | tr 'abc' 'ABC'
|
||||
#|aaa
|
||||
#|bbb
|
||||
End
|
||||
|
||||
When call cat -
|
||||
The first line of output should eq 'AAA'
|
||||
The second line of output should eq 'BBB'
|
||||
End
|
||||
|
||||
Example 'from function'
|
||||
foo() { printf '%s\n' "$@"; }
|
||||
Data foo a b c | tr 'abc' 'ABC' # comment
|
||||
When call cat -
|
||||
The first line of output should eq 'A'
|
||||
The second line of output should eq 'B'
|
||||
The third line of output should eq "C"
|
||||
The lines of entire output should eq 3
|
||||
End
|
||||
|
||||
Example 'from string'
|
||||
Data 'abc' | tr 'abc' 'ABC' # comment
|
||||
When call cat -
|
||||
The output should eq ABC
|
||||
End
|
||||
End
|
||||
|
||||
Describe 'variable expansion'
|
||||
Before 'item=123'
|
||||
|
||||
Example 'not expand variable (default)'
|
||||
Data:raw
|
||||
#|item $item
|
||||
End
|
||||
When call cat -
|
||||
The output should eq 'item $item'
|
||||
End
|
||||
|
||||
Example 'expand variable'
|
||||
Data:expand
|
||||
#|item $item
|
||||
End
|
||||
When call cat -
|
||||
The output should eq 'item 123'
|
||||
End
|
||||
|
||||
# variable expansion is supported by block style only.
|
||||
End
|
||||
End
|
||||
|
||||
Reference in New Issue
Block a user