Mercurial Hosting > bricolage
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:ed67ca9ff4c7 | 1:bce8021ad094 |
---|---|
1 # Bricolage | |
2 | |
3 Bricolage is an ultimately minimal testing library for UNIX Shell. It follows the idea of klud.js and gambiarra.lua | |
4 | |
5 ## Usage | |
6 | |
7 # include b.sh | |
8 . b.sh | |
9 | |
10 # optionally define pass/fail handlers | |
11 pass() { | |
12 echo "PASS $*" | |
13 } | |
14 | |
15 fail() { | |
16 echo "FAIL $*" | |
17 } | |
18 | |
19 # write your test functions | |
20 mytest() { | |
21 # inside use test assertions | |
22 ok 1 -eq 1 | |
23 ok $FOO = "somevalue" | |
24 # mock/spy some commands | |
25 spy ls | |
26 # give fake command output | |
27 echo "file.txt" > $T/spy.ls | |
28 # use fake ls | |
29 ls /some/dir | |
30 # ensure that argument was passed correctly | |
31 ok $(cat $T/spy.ls.args) = "/some/dir" | |
32 # ensure that command return expected output | |
33 ok $(cat $T/spy.ls.stdout) = "file.txt" | |
34 } | |
35 | |
36 # run your tests | |
37 bricolage mytest | |
38 | |
39 # cleanup | |
40 rm -r $T | |
41 | |
42 ## License | |
43 | |
44 Distributed under MIT license |