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 wrote following examples to test a trailing empty line.
Describe "Demo"trailing_empty_line() {
printf"1\n2\n\n"
}
It "Last empty line is not counted"
When call trailing_empty_line
The lines of output should eq 3
End
It "Last empty line is not set"
When call trailing_empty_line
The 3rd line of output should eq ""
End
End
However, these examples failed as below.
$ shellspec --format tap1..2not ok 1 - Demo Last empty line is not counted # FAILED
# (in specfile spec/sample_spec.sh, line 8)
# When call trailing_empty_line
# The lines of output should eq 3
#
# expected: 3
# got: 2
#
not ok 2 - Demo Last empty line is not set # FAILED
# (in specfile spec/sample_spec.sh, line 12)
# When call trailing_empty_line
# The 3rd line of output should eq
#
# expected: ""
# got: <unset>
#
This shellspec behavior is intended one? Can I test trailing empty lines by shellspec?
The text was updated successfully, but these errors were encountered:
Seems like testing the output instead works as expected:
#shellcheck shell=sh
Describe "Demo"
trailing_empty_line() {
printf "1\n2\n\n"
}
It "Last empty line is not counted"
When call trailing_empty_line
The lines of output should eq 3
End
It "Last empty line is not counted"
When call trailing_empty_line
The output should eq "$(trailing_empty_line)"
End
It "Last empty line is not set"
When call trailing_empty_line
The 3rd line of output should eq ""
End
End
Output
$ shellspec ./test.test.sh
Running: /usr/bin/bash [bash 4.4.12(3)-release] {--jobs 3}
F.F
Examples:
1) Demo Last empty line is not counted
When call trailing_empty_line
1.1) The lines of output should eq 3
expected: 3
got: 2
# ./test.test.sh:10
2) Demo Last empty line is not set
When call trailing_empty_line
2.1) The 3rd line of output should eq
expected: ""
got: <unset>
# ./test.test.sh:20
Finished in 1,48 seconds (user 0,64 seconds, sys 1,03 seconds)
3 examples, 2 failures
Failure examples / Errors: (Listed here affect your suite's status)
shellspec ./test.test.sh:8 # 1) Demo Last empty line is not counted FAILED
shellspec ./test.test.sh:18 # 2) Demo Last empty line is not set FAILED
I wrote following examples to test a trailing empty line.
However, these examples failed as below.
This shellspec behavior is intended one? Can I test trailing empty lines by shellspec?
The text was updated successfully, but these errors were encountered: