Skip to content

Commit 40d0e9b

Browse files
committed
Add empty string test cases for expects
- Add test for empty string equality - Add test for empty string compared with non-empty - Add test for non-empty string compared with empty
1 parent 8cd9d01 commit 40d0e9b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/expects.bats

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
@test '`expects "" to_be_defined` should fail' {
196196
run expects "" to_be_defined
197197
[[ $status -eq 1 ]]
198-
[[ $output == "FAIL: expected {actual} to_be_defined, but {actual} is empty" ]]
198+
[[ $output == "FAIL: expected {actual} to_be_defined, but {actual} is (empty)" ]]
199199
}
200200

201201
@test '`expects "" not to_be_defined` should succeed' {
@@ -208,3 +208,20 @@
208208
[[ $status -eq 1 ]]
209209
[[ $output == "FAIL: expected {actual} not to_be_defined, but {actual} is 'value'" ]]
210210
}
211+
212+
@test '`expects "" to_equal ""` should succeed' {
213+
run expects "" to_equal ""
214+
[[ $status -eq 0 ]]
215+
}
216+
217+
@test '`expects "" to_equal "x"` should fail' {
218+
run expects "" to_equal "x"
219+
[[ $status -eq 1 ]]
220+
[[ $output == "FAIL: expected {actual} to_equal 'x', but {actual} is (empty)" ]]
221+
}
222+
223+
@test '`expects "x" to_equal ""` should fail' {
224+
run expects "x" to_equal ""
225+
[[ $status -eq 1 ]]
226+
[[ $output == "FAIL: expected {actual} to_equal (empty), but {actual} is 'x'" ]]
227+
}

0 commit comments

Comments
 (0)