Assert/Refute against nonempty/empty output#15
Assert/Refute against nonempty/empty output#15jasonkarns wants to merge 9 commits intoztombol:masterfrom
Conversation
src/assert.bash
Outdated
| if (( is_mode_nonempty )); then | ||
| if [ -z "$output" ]; then | ||
| echo 'expected non-empty output, but output was empty' \ | ||
| | batslib_decorate 'no output' \ |
There was a problem hiding this comment.
Please, use an additional 2 space indentation before the pipes to follow the style of existing code. If you want to change style, I'm up for debating in a separate issue.
There was a problem hiding this comment.
No strong preference. I just use the formatter that comes built-in with vim, which had them not indented.
src/assert.bash
Outdated
| if (( is_mode_empty )); then | ||
| if [ -n "$output" ]; then | ||
| echo 'expected no output, but output was non-empty' \ | ||
| | batslib_decorate 'unexpected output' \ |
There was a problem hiding this comment.
We should show $output here. See a few lines later in this function how to do that.
src/assert.bash
Outdated
| if (( is_mode_empty )); then | ||
| if [ -n "$output" ]; then | ||
| echo 'expected no output, but output was non-empty' \ | ||
| | batslib_decorate 'unexpected output' \ |
There was a problem hiding this comment.
Add 2 spaces of indentation here too, please.
test/50-assert-15-assert_output.bats
Outdated
| run echo 'a' | ||
| run assert_output <<STDIN | ||
| run assert_output | ||
| echo "$output" |
There was a problem hiding this comment.
I think you may have left this in by accident. I do this a lot too.. intentionally not identing the echos so I will spot them before commiting, but I end up leaving them there. 😄
test/50-assert-15-assert_output.bats
Outdated
| @test 'assert_output(): fails if output is empty' { | ||
| run echo '' | ||
| run assert_output | ||
| echo "$output" |
test/50-assert-16-refute_output.bats
Outdated
| @test 'refute_output(): succeeds if output is empty' { | ||
| run echo '' | ||
| run refute_output | ||
| echo "$output" |
test/50-assert-16-refute_output.bats
Outdated
| run echo 'a' | ||
| run refute_output <<INPUT | ||
| run refute_output | ||
| echo "$output" |
|
Indentation fixed; debugging echos removed; improved error messaging. |
|
bump (changes had been made as requested) |
|
merged in my fork: bats-core@44c1c08 |
Closes #5; Depends on #14
Do not merge; still needs update to docs.Docs added.