mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-01-26 11:43:59 +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.
76 lines
1.9 KiB
Bash
76 lines
1.9 KiB
Bash
# shellcheck shell=sh disable=SC2016
|
|
|
|
Describe 'evaluation example'
|
|
Describe 'call evaluation'
|
|
It 'calls function'
|
|
foo() { echo "foo"; }
|
|
When call foo # this is evaluation
|
|
The output should eq "foo"
|
|
End
|
|
|
|
It 'calls external command also'
|
|
When call expr 1 + 2
|
|
The output should eq 3
|
|
End
|
|
|
|
It 'calls the defined function instead of external command that same name'
|
|
expr() { echo "be called"; }
|
|
When call expr 1 + 2
|
|
The output should eq "be called"
|
|
End
|
|
|
|
It 'must be one call each example'
|
|
When call echo 1
|
|
When call echo 2 # cannot be called more than once.
|
|
The output should eq 1
|
|
End
|
|
|
|
It 'not calling is allowed'
|
|
The value 123 should eq 123
|
|
End
|
|
|
|
It 'cannot be called after expectation'
|
|
The value 123 should eq 123
|
|
When call echo 1 # cannot be called after expectation.
|
|
End
|
|
|
|
It 'calls external command'
|
|
expr() { echo "not called"; }
|
|
When run command expr 1 + 2
|
|
The output should eq 3
|
|
End
|
|
End
|
|
|
|
Describe 'run evaluation'
|
|
It 'can trap exit'
|
|
abort() { exit 1; }
|
|
When run abort # if use "call evaluation", shellspec is terminate
|
|
The status should be failure
|
|
End
|
|
|
|
It 'cannot modify variable because it run with in subshell'
|
|
set_value() { SHELLSPEC_VERSION=$1; }
|
|
When run set_value 'no-version'
|
|
The value "$SHELLSPEC_VERSION" should not eq 'no-version'
|
|
End
|
|
|
|
It 'calls BeforeRun/AfterRun hook'
|
|
before_run() {
|
|
# You can temporary redefine function here
|
|
# redefined function is restored after run evaluation
|
|
# because run evaluation runs with in subshell
|
|
echo before
|
|
}
|
|
after_run() {
|
|
echo after
|
|
}
|
|
BeforeRun before_run
|
|
AfterRun after_run
|
|
When run echo 123
|
|
The line 1 of output should eq 'before'
|
|
The line 2 of output should eq 123
|
|
The line 3 of output should eq 'after'
|
|
End
|
|
End
|
|
End
|