Build simple, elegant, unit tests for libraries written in shell (bash or ksh). The quickest way to get started is to watch the free training videos, which can be found here.
Enable debug dumps if debug is loaded. Defaults to on.
Disble debug dumpes.
Enables automatic debug dumps after passing tests.
Disables automatic debug dumps after passing tests.
Define one or more lines to run before running the tests for a file.
> unittest_header [ -stdin | "header_text" ]
Run the tests associated with a file.
> unittest_test [-tap,-t] [-lint,-l] [-shell,-s "X"] "file" "[regex]" # -tap: Return results using Test Anything Protocal. # -lint: Runs lint tests instead of normal unit tests.. # file: Test file. Use full path. # regex: Limit tests to those matching ```regex```.
Cleans up header and temporary files after running a series of unit tests.
Signals a passing test.
Signals a failing test.
> fail_test ["test_failure_message"] # test_failure_message: Test failure message.
stdin against the defined options.
> assert [!] [-lines,-l X|-f|-d|-n|-z|X|"str"] ["test_failure_message"] # !: Not operator. # -lines: Input should match X number of lines. # -f: Input is existing file. # -d: Input is existing directory. # -n: Input exists. # -z: Input is null. # X: Input equals number. # str: Input equals string.
assertion is true.
> assert_true assertion ["test_failure_message"]
assertion is false.
> assert_false assertion ["test_failure_message"]
> assert_sleep X
Injects a message during testing. For example of you need to warn about some expected error or something.
> assert_banner "str"
Asserts that at least one line from
> assert_match "regex" ["test_failure_message"]
Asserts that none of the lines read from
> assert_nomatch "regex" ["test_failure_message"]