5 .include 'test_more.pir'
6 .local pmc tapir, klass
7 load_bytecode 'lib/Tapir/Parser.pbc'
8 load_bytecode 'lib/Tapir/Stream.pbc'
13 klass = newclass [ 'Tapir'; 'Parser' ]
17 test_parse_plan(tapir)
18 test_parse_invalid_plan(tapir)
26 num_tests = tapir.'parse_plan'("1..5")
27 is(num_tests,5,'parse_plan can parse a simple plan')
29 num_tests = tapir.'parse_plan'("1..1")
30 is(num_tests,1,'parse_plan can parse a single test plan')
32 num_tests = tapir.'parse_plan'("1..0")
33 is(num_tests,0,'parse_plan can parse a no-test plan')
37 .sub test_parse_invalid_plan
41 # these are not valid and should cause an "invalid plan" error
42 num_tests = tapir.'parse_plan'("-42..0")
43 is(num_tests,-1,'parse_plan indicates an invalid plan for -42..0')
45 num_tests = tapir.'parse_plan'("-42..42")
46 is(num_tests,-1,'parse_plan indicates an invalid plan for -42..42')
48 num_tests = tapir.'parse_plan'("0..1")
49 is(num_tests,-1,'parse_plan indicates an invalid plan for 0..1')
51 num_tests = tapir.'parse_plan'("1...69")
52 is(num_tests,-1,'parse_plan indicates an invalid plan for 1...69')
54 num_tests = tapir.'parse_plan'("1..")
55 is(num_tests,-1,'parse_plan indicates an invalid plan for 1..')
57 num_tests = tapir.'parse_plan'("1.2..69")
58 is(num_tests,-1,'parse_plan indicates an invalid plan for 1.2..69')
60 num_tests = tapir.'parse_plan'("This is not even close to a valid plan!")
61 is(num_tests,-1,'parse_plan indicates an invalid plan for junk')
63 num_tests = tapir.'parse_plan'("....2")
64 is(num_tests,-1,'parse_plan indicates an invalid plan for ....2')
71 # vim: expandtab shiftwidth=4 ft=pir: