5 .include 'test_more.pir'
6 .local pmc tapir, klass
7 load_bytecode 'lib/Tapir/Stream.pbc'
8 load_bytecode 'lib/Tapir/Parser.pbc'
13 klass = newclass [ 'Tapir'; 'Parser' ]
16 test_parse_death(tapir)
17 test_parse_death_with_passing_tests(tapir)
18 test_plumage_sanity(tapir)
20 test_exit_code_pass(tapir)
21 test_parse_tapstream_out_of_order(tapir)
24 .sub test_parse_tapstream_out_of_order
26 .local string tap_error
35 stream = tapir.'parse_tapstream'(tap_error)
37 $I0 = stream.'get_plan'()
38 is($I0,4,"plan is correct")
40 $I0 = stream.'is_pass'()
41 is($I0,0,"parse_tapstream does not pass something with out of order tests")
43 $I0 = stream.'get_pass'()
44 is($I0,4,"parse_tapstream gets 4 passed tests")
46 $I0 = stream.'get_todo'()
47 is($I0,0,"parse_tapstream gets no todo tests")
49 $I0 = stream.'get_skip'()
50 is($I0,0,"parse_tapstream gets no skip tests")
52 $I0 = stream.'get_fail'()
53 is($I0,0,"parse_tapstream gets no fails")
55 $I0 = stream.'total'()
56 is($I0,4,"parse_tapstream gets correct # of tests in total")
58 $I0 = stream.'get_exit_code'()
59 is($I0,0,"parse_tapstream gets correct exit code")
63 .sub test_exit_code_pass
69 ok 1 - Class of Tapir::Parser is of the correct type
70 ok 2 - new returns a Tapir::Parser object isa Tapir;Parser
72 stream = tapir.'parse_tapstream'(tap,0)
73 $I0 = stream.'get_exit_code'()
74 is($I0,0,"parse_tapstream gets passing exit code")
80 .local string tap_error
84 ok 1 - Class of Tapir::Parser is of the correct type
85 ok 2 - new returns a Tapir::Parser object isa Tapir;Parser
87 current instr.: 'parrot;Tapir;Stream;main' pc 554 (t/00-sanity.t:20)
89 stream = tapir.'parse_tapstream'(tap_error,42)
91 $I0 = stream.'get_plan'()
92 is($I0,2,"plan is correct")
94 $I0 = stream.'is_pass'()
95 is($I0,0,"parse_tapstream does not pass something with a non-successful exit code")
97 $I0 = stream.'get_pass'()
98 is($I0,2,"parse_tapstream gets 2 passed tests")
100 $I0 = stream.'get_todo'()
101 is($I0,0,"parse_tapstream gets no todo tests")
103 $I0 = stream.'get_skip'()
104 is($I0,0,"parse_tapstream gets no skip tests")
106 $I0 = stream.'get_fail'()
107 is($I0,0,"parse_tapstream gets no fails")
109 $I0 = stream.'total'()
110 is($I0,2,"parse_tapstream gets correct # of tests in total")
112 $I0 = stream.'get_exit_code'()
113 is($I0,42,"parse_tapstream gets correct exit code")
117 .sub test_plumage_sanity
119 .local string tap_error
123 invalidjunkdoesnotexist
124 ok 1 - do_run()ing invalidjunk returns false
125 ./plumage asdfversion
126 I don't know how to 'asdfversion'!
127 ok 2 - plumage returns failure for invalid commands
133 ok 8 - no args give usage
134 ok 9 - no args give usage
135 ok 10 - plumage fetch no args
139 This is Parrot Plumage, version 0.
141 Copyright (C) 2009, Parrot Foundation.
143 This code is distributed under the terms of the Artistic License 2.0.
144 For more details, see the full text of the license in the LICENSE file
145 included in the Parrot Plumage source tree.
146 ok 13 - plumage version returns success
147 ok 14 - plumage version knows its name
148 ok 15 - version mentions Parrot Foundation
149 ok 16 - version mentions Artistic License
154 stream = tapir.'parse_tapstream'(tap_error)
156 $I0 = stream.'get_plan'()
157 is($I0,18,"plan is correct")
159 $I0 = stream.'is_pass'()
160 is($I0,1,"parse_tapstream passes Plumage's sanity test")
162 $I0 = stream.'get_pass'()
163 is($I0,18,"parse_tapstream gets 18 tests")
165 $I0 = stream.'get_todo'()
166 is($I0,0,"parse_tapstream gets no todo tests")
168 $I0 = stream.'get_skip'()
169 is($I0,0,"parse_tapstream gets no skip tests")
171 $I0 = stream.'get_fail'()
172 is($I0,0,"parse_tapstream gets no fails")
174 $I0 = stream.'total'()
175 is($I0,18,"parse_tapstream gets 18 tests in total")
178 .sub test_parse_death
180 .local string tap_error
184 not ok 1 - newclass Tapir::Parser is of the correct type
187 get_bool() not implemented in class 'Tapir;Parser'
188 current instr.: 'parrot;Test;More;ok' pc 39 (runtime/parrot/library/Test/More.pir:108)
189 called from Sub 'parrot;Tapir;Stream;main' pc 505 (t/00-sanity.t:18)
191 stream = tapir.'parse_tapstream'(tap_error)
193 $I0 = stream.'is_pass'()
194 is($I0,0,"parse_tapstream does not pass a TAP stream with a death message")
196 $I0 = stream.'get_pass'()
197 is($I0,0,"parse_tapstream gets no passed tests")
199 $I0 = stream.'get_todo'()
200 is($I0,0,"parse_tapstream gets 0 todo tests")
202 $I0 = stream.'get_skip'()
203 is($I0,0,"parse_tapstream gets 0 skip tests")
205 $I0 = stream.'get_fail'()
206 is($I0,1,"parse_tapstream gets one failed test")
208 $I0 = stream.'total'()
209 is($I0,1,"parse_tapstream gets one test in total")
213 .sub test_parse_death_with_passing_tests
215 .local string tap_error
219 ok 1 - new returns a Tapir::Parser object isa Tapir;Parser
220 Class Stream already registered!
222 current instr.: 'parrot;Tapir;Stream;main' pc 495 (t/00-sanity.t:18)
224 stream = tapir.'parse_tapstream'(tap_error)
226 $I0 = stream.'is_pass'()
227 is($I0,0,"parse_tapstream does not pass a TAP stream with a death message")
229 $I0 = stream.'get_pass'()
230 is($I0,1,"parse_tapstream gets 1 passing test")
232 $I0 = stream.'get_todo'()
233 is($I0,0,"parse_tapstream gets 0 todo tests")
235 $I0 = stream.'get_skip'()
236 is($I0,0,"parse_tapstream gets 0 skip tests")
238 $I0 = stream.'get_fail'()
239 is($I0,0,"parse_tapstream gets no failing tests")
241 $I0 = stream.'total'()
242 is($I0,1,"parse_tapstream gets one test in total")
249 # vim: expandtab shiftwidth=4 ft=pir: