Skip to content

Assert/Refute against nonempty/empty output - #15

Open
jasonkarns wants to merge 9 commits into
ztombol:masterfrom
bats-core:assert-refute-empty
Open

jasonkarns wants to merge 9 commits into
ztombol:masterfrom
bats-core:assert-refute-empty

Conversation

@jasonkarns

@jasonkarns jasonkarns commented Jun 18, 2016 •

Copy link
Copy Markdown
Contributor

Closes #5; Depends on #14

Do not merge; still needs update to docs. Docs added.

Comment thread 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' \

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong preference. I just use the formatter that comes built-in with vim, which had them not indented.

Comment thread 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' \

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should show $output here. See a few lines later in this function how to do that.

Comment thread 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' \

@ztombol ztombol Sep 25, 2016 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add 2 spaces of indentation here too, please.

Comment thread test/50-assert-15-assert_output.bats Outdated
run echo 'a'
run assert_output <<STDIN
run assert_output
echo "$output"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. 😄

Comment thread test/50-assert-15-assert_output.bats Outdated
@test 'assert_output(): fails if output is empty' {
run echo ''
run assert_output
echo "$output"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another forgotten debug print.

Comment thread test/50-assert-16-refute_output.bats Outdated
@test 'refute_output(): succeeds if output is empty' {
run echo ''
run refute_output
echo "$output"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another forgotten debug print.

Comment thread test/50-assert-16-refute_output.bats Outdated
run echo 'a'
run refute_output <<INPUT
run refute_output
echo "$output"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another forgotten debug print.

@jasonkarns

Copy link
Copy Markdown
Contributor Author

Indentation fixed; debugging echos removed; improved error messaging.

@ztombol ztombol mentioned this pull request Nov 8, 2016
@jasonkarns

Copy link
Copy Markdown
Contributor Author

bump (changes had been made as requested)

@jasonkarns

Copy link
Copy Markdown
Contributor Author

merged in my fork: bats-core@44c1c08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants