-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add contains and does_not_contain assertion methods
- Loading branch information
Showing
3 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env zunit | ||
|
||
@test 'Test _zunit_assert_contains match' { | ||
run assert 'hello world' contains 'lo wo' | ||
|
||
assert "$output" is_empty | ||
assert $state equals 0 | ||
} | ||
|
||
@test 'Test _zunit_assert_contains suffix match' { | ||
run assert 'hello world' contains 'world' | ||
|
||
assert "$output" is_empty | ||
assert $state equals 0 | ||
} | ||
|
||
@test 'Test _zunit_assert_contains prefix match' { | ||
run assert 'hello world' contains 'hello' | ||
|
||
assert "$output" is_empty | ||
assert $state equals 0 | ||
} | ||
|
||
@test 'Test _zunit_assert_contains whole word matches' { | ||
run assert 'red blue green' contains 'red blue green' | ||
|
||
assert "$output" is_empty | ||
assert $state equals 0 | ||
} | ||
|
||
@test 'Test _zunit_assert_contains match failure' { | ||
run assert 'elephants' contains 'foo' | ||
|
||
assert "$output" same_as "'elephants' does not contain 'foo'" | ||
assert $state equals 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env zunit | ||
|
||
@test 'Test _zunit_assert_does_not_contain success' { | ||
run assert 'yellow' does_not_contain 'foo' | ||
|
||
assert "$output" is_empty | ||
assert $state equals 0 | ||
} | ||
|
||
@test 'Test _zunit_assert_does_not_contain failure' { | ||
run assert 'foobar' does_not_contain 'foo' | ||
|
||
assert "$output" same_as "'foobar' contains 'foo'" | ||
assert $state equals 1 | ||
} |