Permalink
Browse files

Add some tests for parsing out of order tests, mostly passing.

Currently we do not count any tests that are out of order as passed,
so test files with out of order tests do not pass, but this is currently
dumb luck. The parse_tapstream method needs to be modified to detect
out of order tests and still count which pass and fail.
  • Loading branch information...
1 parent 00cc34d commit 7b1962d6cc86d8eab35f9dac3fad292cd3ee1b1a @leto committed Dec 5, 2009
Showing with 41 additions and 1 deletion.
  1. +41 −1 t/03-parse_tapstream_error.t
@@ -7,7 +7,7 @@
load_bytecode 'lib/Tapir/Stream.pbc'
load_bytecode 'lib/Tapir/Parser.pbc'
- plan(28)
+ plan(35)
# setup test data
klass = newclass [ 'Tapir'; 'Parser' ]
@@ -18,6 +18,46 @@
test_plumage_sanity(tapir)
test_exit_code(tapir)
test_exit_code_pass(tapir)
+ test_parse_tapstream_out_of_order(tapir)
+.end
+
+.sub test_parse_tapstream_out_of_order
+ .param pmc tapir
+ .local string tap_error
+ .local pmc stream
+ tap_error = <<"TAP"
+1..4
+ok 1 - foo
+ok 3 - bar
+ok 2 - baz
+ok 4 - fuzzlebub
+TAP
+ stream = tapir.'parse_tapstream'(tap_error)
+
+ $I0 = stream.'get_plan'()
+ is($I0,4,"plan is correct")
+
+ $I0 = stream.'is_pass'()
+ is($I0,0,"parse_tapstream does not pass something with out of order tests")
+
+ $I0 = stream.'get_pass'()
+ is($I0,4,"parse_tapstream gets 4 passed tests")
+
+ $I0 = stream.'get_todo'()
+ is($I0,0,"parse_tapstream gets no todo tests")
+
+ $I0 = stream.'get_skip'()
+ is($I0,0,"parse_tapstream gets no skip tests")
+
+ $I0 = stream.'get_fail'()
+ is($I0,0,"parse_tapstream gets no fails")
+
+ $I0 = stream.'total'()
+ is($I0,4,"parse_tapstream gets correct # of tests in total")
+
+ $I0 = stream.'get_exit_code'()
+ is($I0,0,"parse_tapstream gets correct exit code")
+
.end
.sub test_exit_code_pass

0 comments on commit 7b1962d

Please sign in to comment.