"Who would dare assert that we know all there is to be known?" ~ Galileo Galilei
At the time of this writing there are 3 separate libraries that offer assertions for the Bash Automated Testing System (otherwise known as BATS).
These are:
This page shows a comparison of the functions each projects offers.
Symbol | Meaning |
---|---|
JBA | jasonkarns/bats-assert |
TBA | thingsym/bats-assertion |
ZBA | ztombol/bats-assert |
foo |
Affirmatory function |
foo |
Negatory function |
π | Function present |
βοΈ | Other function can be used |
βοΈ | Alias present |
Function Name | Also Known As | JBA | TBA | ZBA |
---|---|---|---|---|
fail |
flunk |
βοΈ | βοΈ 1 | |
assert |
π | π | ||
refute |
π | π | ||
assert_contains |
assert_output_contains |
π | βοΈ 2 | |
refute_contains |
refute_output_contains |
π | βοΈ 2 | |
assert_equal |
π | π | π | |
refute_equal |
assert_fail_equal |
βοΈ | ||
assert_line |
π | π | ||
refute_line |
π | π | ||
assert_lines_equal |
π | |||
refute_lines_equal |
assert_fail_lines_equal |
βοΈ | ||
assert_lines_match |
π | |||
refute_lines_match |
assert_fail_lines_match |
βοΈ | ||
assert_match |
π | |||
refute_match |
assert_fail_match |
βοΈ | ||
assert_output |
π | π | ||
refute_output |
π | |||
assert_success |
π | π | π | |
refute_success |
assert_failure |
βοΈ | βοΈ | βοΈ |
assert_starts_with |
π | βοΈ 3 | ||
refute_starts_with |
βοΈ 3 | |||
assert_status |
π | βοΈ 4 | ||
TOTAL (Per project) | 12 | 11 | 15 |
- 1 ZBA supports
fail
through its dependency on bats-support - 2 ZBA supports
assert_contains
by usingassert_output --partial
orassert_output --regex options
- 3 ZBA supports
assert_starts_with
by usingassert_contains
with a/^.../
regex. (same withrefute_starts_with
) - 4 ZBA supports asserting an explicit status "N" using
assert_failure N
22 Function present across all projects
@jasonkarns Thanks for the review! I've updated the comparison based on your feedback.
refute_status
andpass
have been removed, as I agree that they don't serve much purpose.assert_status
in, as I should be able to check for a status other than0
or1
.assert_contains
andassert_starts_with
have been added to ZBA.