Permalink
Browse files

Add tests for bail_if_necessary to Tapir::Parser

  • Loading branch information...
1 parent fb239bd commit eda3b9e473a15a14893a2b7b5f0eeb72c6e58267 @leto committed Jan 23, 2010
Showing with 15 additions and 1 deletion.
  1. +15 −1 t/03-parse_tapstream_error.t
@@ -7,7 +7,7 @@
load_bytecode 'lib/Tapir/Stream.pbc'
load_bytecode 'lib/Tapir/Parser.pbc'
- plan(42)
+ plan(44)
# setup test data
klass = newclass [ 'Tapir'; 'Parser' ]
@@ -20,6 +20,20 @@
test_exit_code_pass(tapir)
test_parse_tapstream_out_of_order(tapir)
test_is_tap(tapir)
+ test_is_bail(tapir)
+.end
+
+.sub test_is_bail
+ .param pmc tapir
+ .local pmc stream
+
+ $S0 = 'Who paid for this damn Bail out!?!'
+ $I0 = tapir.'bail_if_necessary'($S0)
+ is($I0,0,'bail_if_necessary does not get fooled by invalid bailout line')
+
+ $S0 = 'Bail out!'
+ $I0 = tapir.'bail_if_necessary'($S0)
+ is($I0,1,'bail_if_necessary detects valid bailout')
.end
.sub test_is_tap

0 comments on commit eda3b9e

Please sign in to comment.