Skip to content

Commit

Permalink
Improve test formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Rein Henrichs committed Sep 9, 2011
1 parent ed0c092 commit 7362eb1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
5 changes: 4 additions & 1 deletion test/test_failing.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
. lib/test_helper.sh

( bin/batunit "test/fixtures/test_fail.sh" &>/dev/null ) && flunk "TEST"
( bin/batunit "test/fixtures/test_fail.sh" &>/dev/null ) &&
flunk "should exit !0 but was $?"
exit 0

# vim: sw=4:ts=4:sts=4
18 changes: 14 additions & 4 deletions test/test_output.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
. lib/test_helper.sh

# Summary output
( bin/batunit test/fixtures/test_pass.sh | grep -q 'Finished: 1 tests, 0 failures, 0 pending' &>/dev/null ) || flunk "Test summary should be correct"
( bin/batunit test/fixtures/test_fail.sh | grep -q 'Finished: 1 tests, 1 failures, 0 pending' &>/dev/null ) || flunk "Test summary should be correct"
( bin/batunit test/fixtures/test_pending.sh | grep -q 'Finished: 1 tests, 0 failures, 1 pending' &>/dev/null ) || flunk "Test summary should be correct"
( bin/batunit test/fixtures/*.sh | grep -q 'Finished: 3 tests, 1 failures, 1 pending' &>/dev/null ) || flunk "Test summary should be correct"
( bin/batunit test/fixtures/test_pass.sh | grep -q 'Finished: 1 tests, 0 failures, 0 pending' &>/dev/null ) ||
flunk "Test summary should be correct"

( bin/batunit test/fixtures/test_fail.sh | grep -q 'Finished: 1 tests, 1 failures, 0 pending' &>/dev/null ) ||
flunk "Test summary should be correct"

( bin/batunit test/fixtures/test_pending.sh | grep -q 'Finished: 1 tests, 0 failures, 1 pending' &>/dev/null ) ||
flunk "Test summary should be correct"

( bin/batunit test/fixtures/*.sh | grep -q 'Finished: 3 tests, 1 failures, 1 pending' &>/dev/null ) ||
flunk "Test summary should be correct"

exit 0

# vim: sw=4:ts=4:sts=4
5 changes: 4 additions & 1 deletion test/test_passing.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
. lib/test_helper.sh

( bin/batunit "test/fixtures/test_pass.sh" &>/dev/null ) || flunk "test_pass.sh should exit 0 but was $?"
( bin/batunit "test/fixtures/test_pass.sh" &>/dev/null ) ||
flunk "should exit 0 but was $?"
exit 0

# vim: sw=4:ts=4:sts=4
6 changes: 5 additions & 1 deletion test/test_pending.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
. lib/test_helper.sh

# pending
( bin/batunit "test/fixtures/test_pending.sh" 2>&1 | grep -q '1 pending' ) || flunk "test_pending.sh should be pending"
( bin/batunit "test/fixtures/test_pending.sh" 2>&1 | grep -q '1 pending' ) ||
flunk "test_pending.sh should be pending"

exit 0

# vim: sw=4:ts=4:sts=4

0 comments on commit 7362eb1

Please sign in to comment.