Skip to content

Assert/Refute against nonempty/empty output#15

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

Assert/Refute against nonempty/empty output#15
jasonkarns wants to merge 9 commits intoztombol:masterfrom
bats-core:assert-refute-empty

Conversation

@jasonkarns
Copy link
Contributor

@jasonkarns jasonkarns commented Jun 18, 2016

Closes #5; Depends on #14

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

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

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

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
Owner

@ztombol ztombol Sep 25, 2016

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.

run echo 'a'
run assert_output <<STDIN
run assert_output
echo "$output"
Copy link
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. 😄

@test 'assert_output(): fails if output is empty' {
run echo ''
run assert_output
echo "$output"
Copy link
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.

@test 'refute_output(): succeeds if output is empty' {
run echo ''
run refute_output
echo "$output"
Copy link
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.

run echo 'a'
run refute_output <<INPUT
run refute_output
echo "$output"
Copy link
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
Contributor Author

Indentation fixed; debugging echos removed; improved error messaging.

@ztombol ztombol mentioned this pull request Nov 8, 2016
@jasonkarns
Copy link
Contributor Author

bump (changes had been made as requested)

@jasonkarns
Copy link
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