Skip to content

Commit

Permalink
Merge pull request #22 from jasonkarns/set-u
Browse files Browse the repository at this point in the history
Ensure helpers safe under -u
  • Loading branch information
jasonkarns authored Jan 30, 2019
2 parents 8f177a6 + b9cc724 commit 58efb03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
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

0 comments on commit 58efb03

Please sign in to comment.