HTTPS SSH

Bricolage

Bricolage is an ultimately minimal testing library for UNIX Shell. It follows the idea of klud.js and gambiarra.lua

Usage

# include b.sh
. b.sh

# optionally define pass/fail handlers
pass() {
    echo "PASS $*"
}

fail() {
    echo "FAIL $*"
}

# write your test functions
mytest() {
    # inside use test assertions
    ok 1 -eq 1
    ok $FOO = "somevalue"
    # mock/spy some commands
    spy ls
    # give fake command output
    echo "file.txt" > $T/spy.ls
    # use fake ls
    ls /some/dir
    # ensure that argument was passed correctly
    ok $(cat $T/spy.ls.args) = "/some/dir"
    # ensure that command return expected output
    ok $(cat $T/spy.ls.stdout) = "file.txt"
}

# run your tests
bricolage mytest

# cleanup
rm -r $T

License

Distributed under MIT license