mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-01-30 14:45:35 +00:00
- 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.
101 lines
1.9 KiB
Bash
101 lines
1.9 KiB
Bash
# shellcheck shell=sh
|
|
|
|
Describe 'skip example'
|
|
Describe 'calc()'
|
|
calc() { echo "$(($*))"; }
|
|
|
|
It 'can add'
|
|
When call calc 1 + 1
|
|
The output should eq 2
|
|
End
|
|
|
|
It 'can minus'
|
|
When call calc 1 - 1
|
|
The output should eq 0
|
|
End
|
|
|
|
# Skip examples of after this line in current example group
|
|
Skip "decimal point cannot be calculated"
|
|
|
|
It 'can add decimal point'
|
|
When call calc 1.1 + 1.1
|
|
The output should eq 2.2
|
|
End
|
|
|
|
It 'can minus decimal point'
|
|
When call calc 1.1 - 1.1
|
|
The output should eq 0
|
|
End
|
|
|
|
Describe 'Multiplication' # example group is also skipped
|
|
It 'can multiply decimal point'
|
|
When call calc 1.1 '*' 1.1
|
|
The output should eq 1.21
|
|
End
|
|
End
|
|
End
|
|
|
|
Describe 'status_to_signal()'
|
|
status_to_signal() {
|
|
if [ 128 -le "$1" ] && [ "$1" -le 192 ]; then
|
|
echo "$(($1 - 128))"
|
|
else
|
|
# Not implemented: echo "status is out of range" >&2
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
It 'cannot convert status to signal'
|
|
When call status_to_signal 0
|
|
The status should be failure
|
|
|
|
# Skip expection of after this line in current example
|
|
Skip 'outputs error message is not implemented'
|
|
The error should be present
|
|
End
|
|
|
|
# This example is going to execute
|
|
It 'converts status to signal'
|
|
When call status_to_signal 137
|
|
The output should eq 9
|
|
End
|
|
End
|
|
|
|
# "temporary skip" cannot hidden with "--skip-message quiet" option
|
|
Describe 'temporary skip'
|
|
Example 'with Skip helper'
|
|
Skip # without reason
|
|
When call foo
|
|
The status should be success
|
|
End
|
|
|
|
xExample 'with xExample (prepend "x")'
|
|
When call foo
|
|
The status should be success
|
|
End
|
|
|
|
xDescribe 'with xDescribe (prepend "x")'
|
|
Example 'this is also skipped'
|
|
When call foo
|
|
The status should be success
|
|
End
|
|
End
|
|
End
|
|
|
|
Describe 'conditional skip'
|
|
Example 'skip1'
|
|
conditions() { return 0; }
|
|
Skip if "function returns success" conditions
|
|
When call echo ok
|
|
The stdout should eq ok
|
|
End
|
|
|
|
Example 'skip2'
|
|
conditions() { echo "skip"; }
|
|
Skip if 'function returns "skip"' [ "$(conditions)" = "skip" ]
|
|
When call echo ok
|
|
The stdout should eq ok
|
|
End
|
|
End
|
|
End
|