annotate README.md @ 3:0798045f37b5 default tip

Add blog post link to README.
author Jang Rush <weakish@gmail.com>
date Mon, 05 Sep 2022 10:50:14 +0000
parents bce8021ad094
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
1 # Bricolage
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
2
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
3 Bricolage is an ultimately minimal testing library for UNIX Shell. It follows the idea of klud.js and gambiarra.lua
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
4
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
5 ## Usage
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
6
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
7 # include b.sh
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
8 . b.sh
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
9
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
10 # optionally define pass/fail handlers
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
11 pass() {
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
12 echo "PASS $*"
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
13 }
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
14
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
15 fail() {
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
16 echo "FAIL $*"
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
17 }
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
18
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
19 # write your test functions
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
20 mytest() {
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
21 # inside use test assertions
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
22 ok 1 -eq 1
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
23 ok $FOO = "somevalue"
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
24 # mock/spy some commands
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
25 spy ls
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
26 # give fake command output
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
27 echo "file.txt" > $T/spy.ls
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
28 # use fake ls
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
29 ls /some/dir
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
30 # ensure that argument was passed correctly
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
31 ok $(cat $T/spy.ls.args) = "/some/dir"
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
32 # ensure that command return expected output
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
33 ok $(cat $T/spy.ls.stdout) = "file.txt"
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
34 }
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
35
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
36 # run your tests
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
37 bricolage mytest
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
38
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
39 # cleanup
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
40 rm -r $T
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
41
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
42 ## License
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
43
bce8021ad094 added README
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
44 Distributed under MIT license
3
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
45
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
46 ## Reference
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
47
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
48 - [Ultimately minimal unit testing][blog], an introduction of Bricolage's philosophy,
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
49 written by its author.
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
50 - [bitbucket.org/zserge/bricolage][bb], the original code repository,
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
51 404 after BitBucket sunsetting Mercurial hosting.
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
52
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
53 [blog]: https://zserge.com/posts/minimal-testing/
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
54 [bb]: http://bitbucket.org/zserge/bricolage
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
55
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
56 ## License
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
57
0798045f37b5 Add blog post link to README.
Jang Rush <weakish@gmail.com>
parents: 1
diff changeset
58 Distributed under MIT license