Skip to content

Commit 990eb27

Browse files
committed
fix assert = with spaces
1 parent 2342d98 commit 990eb27

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

lib/assert.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assert() {
77
[[ $1 = that ]] && shift
88

99
case $@ in
10-
*' = '*) assert_equal $1 "${*:3}" ;;
10+
*' = '*) assert_equal "$1" "${*:3}" ;;
1111
'output contains '*) assert_output -p "${*:3}" ;;
1212
'output does not contain '*) refute_output -p "${*:5}" ;;
1313
*) fail invalid assertion: $@

lib/assert.bats

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ load assert
55
@test 'assert asserts equality' {
66
assert that 1 = 1
77
}
8+
@test ' asserts equality with spaces' {
9+
assert that 'a b' = a b
10+
}
811
@test ' asserts output content' {
912
run echo abc
1013
assert that output contains b

unit-test.bats

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ repo=https://[email protected]/user/repo.git
2323
}
2424
@test ' sanitizes xtrace' {
2525
skip
26-
assert that `(set -o xtrace && sanitize echo $repo)` = $'+ echo $repo\n $repo'
26+
assert that "`(set -o xtrace && sanitize echo $repo)`" = $'+ echo $repo\n $repo'
2727
}

0 commit comments

Comments
 (0)