You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Bash strict mode in my script and unit tests. When an unset parameter is expanded in my tested script (due to a bug), this cause an error in Shellspec core.
I added an example in the Shellspec specification to bring out this bug:
Context "When using Bash strict mode"
Skip if"not on Bash"test"${BASH:-}"x = x
set -o nounset
fDescribe "Shellspec"
It "runs an example which expands an unset parameter"expand_unset() {
:"${UNSET_PARAMETER}"
}
When call expand_unset
The status should be failure
End
End
End
The expected result would be:
$ shellspec --focusRunning: /bin/sh [bash 5.0.11(1)-release]FExamples: 1) When using Bash strict mode Shellspec runs an example which expands an unset parameter 1.1) Example aborted (exit status: 1) stderr:main: line 93: UNSET_PARAMETER: unbound variable # spec/bugs_spec.sh:4Finished in ? seconds (user ? seconds, sys ? seconds)1 example, 1 failureFailure examples: (Listed here affect your suite's status)shellspec spec/bugs_spec.sh:30 # 1) When using Bash strict mode Shellspec runs an example which expands an unset parameter FAILED
But it is:
$ shellspec --focusRunning: /bin/sh [bash 5.0.11(1)-release]/usr/lib/shellspec/lib/core/outputs.sh: line 176: LF: unbound variableUnexpected output to the stderr at line 29-37 in 'spec/bugs_spec.sh'Finished in ? seconds (user ? seconds, sys ? seconds)0 examples, 0 failures, aborted by an unexpected errorAn unexpected error occurred or output to the stderr. [0] [1] [102]Fatal error occurred, terminated with exit status 1.
And with debug output:
But using the current Shellspec specification does not bring up the bug, because the LF parameter is defined in the specification helper:
I use Bash strict mode in my script and unit tests. When an unset parameter is expanded in my tested script (due to a bug), this cause an error in Shellspec core.
I added an example in the Shellspec specification to bring out this bug:
The expected result would be:
But it is:
And with debug output:
But using the current Shellspec specification does not bring up the bug, because the
LF
parameter is defined in the specification helper:shellspec/spec/spec_helper.sh
Line 66 in c298391
Because this parameter is not defined in my specification helper, it causes the error.
The text was updated successfully, but these errors were encountered: