7 tap.sh
- Useful subset of TAP
(Test Anything Protocol
) for shell scripts
15 ok
'1 = 1' 'Make sure that one equals one'
16 ok
'1 != 2' 'Make sure that one is not two'
19 isnt
2 3 'Two is not three'
24 diag
'This is a diagnostic message'
26 Can also use a heredoc for diag and note
31 * https
://testanything.org
- TAP website
35 Charles McGarvey
<chazmcgarvey@brokenzipper.com
>
39 This software is copyright
(c
) 2017 by Charles McGarvey.
41 This is free software
, licensed under
:
57 if eval "test $_t"; then pass
"$_m"; else fail
"$_m"; fi
69 note
"Expected: $_b" " Got: $_a"
82 note
"Expected: != $_b" " Got: $_a"
87 echo "ok $next_test_number - $@"
88 next_test_number
=$(expr $next_test_number + 1)
92 echo "not ok $next_test_number - $@"
93 next_test_number
=$(expr $next_test_number + 1)