view README.md @ 1:bce8021ad094

added README
author Serge A. Zaitsev <zaitsev.serge@gmail.com>
date Fri, 19 Dec 2014 00:01:19 +0200
parents
children 0798045f37b5
line wrap: on
line source

# 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