"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 failthrough its dependency on bats-support
- 2 ZBA supports assert_containsby usingassert_output --partialorassert_output --regex options
- 3 ZBA supports assert_starts_withby usingassert_containswith a/^.../regex. (same withrefute_starts_with)
- 4 ZBA supports asserting an explicit status "N" using assert_failure N
22 Function present across all projects
assert_containsby usingassert_outputwith the--partialor--regexoptionsassert_successare not equivalent because JBA'sassert_successchecks both status and output. ZBA's only checks status. (uncertain about TBA)assert_containsandassert_output_contains(from JBA) should be considered aliases. only difference is stdin handling which ought to be unifiedassert_starts_withby usingassert_containswith a/^.../regex. (same withrefute_starts_with)assert_statusis the same as combining JBA's and ZBA'sassert_successandassert_failure(assert_successis the same asassert_status 0)passhelper would do, since a test passes by default. how would you expect that to be used?refute_statuswould primarily be used to assert that the exit code is != 0, whichassert_failuredoes, so I'd consider that nearly covered.