annotate example.sh @ 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 ed67ca9ff4c7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
1 # Include bricolage library
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
2 . ./b.sh
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
3
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
4 # Simple test
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
5 mytest() {
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
6 ok 1 -eq 1
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
7 ok foo = foo
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
8 foo="Foo bar"
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
9 ok "$foo" = "Foo bar"
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
10 }
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
11
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
12 myspytest() {
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
13 spy date
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
14 date
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
15 ok "$(cat $T/spy.date.stdout)" != "foo"
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
16 echo foo > $T/spy.date
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
17 date
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
18 ok "$(tail -n 1 $T/spy.date.stdout)" = "foo"
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
19 }
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
20
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
21 # Run tests
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
22 bricolage mytest
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
23 bricolage myspytest
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
24
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
25 # Remove test data
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
26 rm -r "$T"
ed67ca9ff4c7 initial commit
Serge A. Zaitsev <zaitsev.serge@gmail.com>
parents:
diff changeset
27