-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-parse_plan.t
executable file
·45 lines (31 loc) · 931 Bytes
/
01-parse_plan.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env parrot
.include 'lib/Tapir/Parser.pir'
.include 'lib/Tapir/Stream.pir'
.sub main :main
.include 'test_more.pir'
.local pmc tapir, klass
plan(4)
# setup test data
klass = newclass [ 'Tapir'; 'Parser' ]
tapir = klass.'new'()
# run tests
test_parse_plan(tapir)
.end
.sub test_parse_plan
.param pmc tapir
.local int num_tests
num_tests = tapir.'parse_plan'("1..5")
is(num_tests,5,'parse_plan can parse a simple plan')
num_tests = tapir.'parse_plan'("1..1")
is(num_tests,1,'parse_plan can parse a single test plan')
num_tests = tapir.'parse_plan'("1..0")
is(num_tests,0,'parse_plan can parse a no-test plan')
# what should happen?
num_tests = tapir.'parse_plan'("-42..0")
is(num_tests,0,'parse_plan can parse an invalid plan')
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: