From 0a7c40fb74fd5a7cca456f10b293484b936a8cab Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 21 Jan 2010 23:46:33 -0800 Subject: [PATCH] Add tests to start a Bug Hunt There is a bug when printing out how many failing tests occured: (kadath)(~/git/plparrot master )$ parrot t/harness.pir t/test.sql t/test.sql .. failed 2/3 tests FAILED 1 test(s) in 1/1 files (7.5512 seconds) --- t/02-parse_tapstream.t | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/t/02-parse_tapstream.t b/t/02-parse_tapstream.t index d8092a1..c1f4057 100755 --- a/t/02-parse_tapstream.t +++ b/t/02-parse_tapstream.t @@ -7,7 +7,7 @@ load_bytecode 'lib/Tapir/Parser.pbc' load_bytecode 'lib/Tapir/Stream.pbc' - plan(61) + plan(68) # setup test data klass = newclass [ 'Tapir'; 'Parser' ] @@ -25,9 +25,52 @@ test_parse_tapstream_todo(tapir) test_parse_tapstream_skip(tapir) test_parse_tapstream_bail(tapir) + test_parse_tapstream_correct_number_of_failed(tapir) .end +.sub test_parse_tapstream_correct_number_of_failed + .param pmc tapir + .local pmc stream + .local string tap + tap = <<"TAP" +1..3 + +not ok 1 +# Failed test 1 +# have: NULL +# want: 1 +ok 2 +not ok 3 +# Failed test 3 +# have: NULL +# want: cheese +# Looks like you failed 2 tests of 3 +TAP + stream = tapir.'parse_tapstream'(tap) + + $I0 = stream.'get_plan'() + is($I0,3,"parse_tapstream detects the plan correctly") + + $I0 = stream.'get_pass'() + is($I0,1,"parse_tapstream detects 1 passing test") + + $I0 = stream.'get_fail'() + is($I0,2,"parse_tapstream detects 2 failing tests") + + $I0 = stream.'get_todo'() + is($I0,0,"parse_tapstream detects no todo tests") + + $I0 = stream.'get_skip'() + is($I0,0,"parse_tapstream detects two skipped test") + + $I0 = stream.'total'() + is($I0,3,"parse_tapstream detected 3 tests in total") + + $I0 = stream.'is_pass'() + is($I0,0,"parse_tapstream fails this") +.end + .sub test_parse_tapstream_bail .param pmc tapir .local pmc stream -- 2.11.4.GIT