Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure helpers safe under -u #22

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assert_output.bash
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ assert_output() {
if (( use_stdin )); then
expected="$(cat -)"
else
expected="$1"
expected="${1-}"
fi

# Matching.
Expand Down
2 changes: 1 addition & 1 deletion src/refute_output.bash
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ refute_output() {
if (( use_stdin )); then
unexpected="$(cat -)"
else
unexpected="$1"
unexpected="${1-}"
fi

if (( is_mode_regexp == 1 )) && [[ '' =~ $unexpected ]] || (( $? == 2 )); then
Expand Down
3 changes: 3 additions & 0 deletions test/test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ load "${TEST_DEPS_DIR}/bats-support/load.bash"
# Load library.
load '../load'

# validate that bats-assert is safe to use under -u
set -u

: "${status:=}"
: "${lines:=}"
: "${output:=}"
Expand Down