5 .include 'test_more.pir'
6 .local pmc tapir, klass
7 load_bytecode 'lib/Tapir/Stream.pir'
8 load_bytecode 'lib/Tapir/Parser.pir'
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)
23 .sub test_exit_code_pass
29 ok 1 - Class of Tapir::Parser is of the correct type
30 ok 2 - new returns a Tapir::Parser object isa Tapir;Parser
32 stream = tapir.'parse_tapstream'(tap,0)
33 $I0 = stream.'get_exit_code'()
34 is($I0,0,"parse_tapstream gets passing exit code")
40 .local string tap_error
44 ok 1 - Class of Tapir::Parser is of the correct type
45 ok 2 - new returns a Tapir::Parser object isa Tapir;Parser
47 current instr.: 'parrot;Tapir;Stream;main' pc 554 (t/00-sanity.t:20)
49 stream = tapir.'parse_tapstream'(tap_error,42)
51 $I0 = stream.'get_plan'()
52 is($I0,2,"plan is correct")
54 $I0 = stream.'is_pass'()
55 is($I0,0,"parse_tapstream does not pass something with a non-successful exit code")
57 $I0 = stream.'get_pass'()
58 is($I0,2,"parse_tapstream gets 2 passed tests")
60 $I0 = stream.'get_todo'()
61 is($I0,0,"parse_tapstream gets no todo tests")
63 $I0 = stream.'get_skip'()
64 is($I0,0,"parse_tapstream gets no skip tests")
66 $I0 = stream.'get_fail'()
67 is($I0,0,"parse_tapstream gets no fails")
69 $I0 = stream.'total'()
70 is($I0,2,"parse_tapstream gets correct # of tests in total")
72 $I0 = stream.'get_exit_code'()
73 is($I0,42,"parse_tapstream gets correct exit code")
77 .sub test_plumage_sanity
79 .local string tap_error
83 invalidjunkdoesnotexist
84 ok 1 - do_run()ing invalidjunk returns false
86 I don't know how to 'asdfversion'!
87 ok 2 - plumage returns failure for invalid commands
93 ok 8 - no args give usage
94 ok 9 - no args give usage
95 ok 10 - plumage fetch no args
99 This is Parrot Plumage, version 0.
101 Copyright (C) 2009, Parrot Foundation.
103 This code is distributed under the terms of the Artistic License 2.0.
104 For more details, see the full text of the license in the LICENSE file
105 included in the Parrot Plumage source tree.
106 ok 13 - plumage version returns success
107 ok 14 - plumage version knows its name
108 ok 15 - version mentions Parrot Foundation
109 ok 16 - version mentions Artistic License
114 stream = tapir.'parse_tapstream'(tap_error)
116 $I0 = stream.'get_plan'()
117 is($I0,18,"plan is correct")
119 $I0 = stream.'is_pass'()
120 is($I0,1,"parse_tapstream passes Plumage's sanity test")
122 $I0 = stream.'get_pass'()
123 is($I0,18,"parse_tapstream gets 18 tests")
125 $I0 = stream.'get_todo'()
126 is($I0,0,"parse_tapstream gets no todo tests")
128 $I0 = stream.'get_skip'()
129 is($I0,0,"parse_tapstream gets no skip tests")
131 $I0 = stream.'get_fail'()
132 is($I0,0,"parse_tapstream gets no fails")
134 $I0 = stream.'total'()
135 is($I0,18,"parse_tapstream gets 18 tests in total")
138 .sub test_parse_death
140 .local string tap_error
144 not ok 1 - newclass Tapir::Parser is of the correct type
147 get_bool() not implemented in class 'Tapir;Parser'
148 current instr.: 'parrot;Test;More;ok' pc 39 (runtime/parrot/library/Test/More.pir:108)
149 called from Sub 'parrot;Tapir;Stream;main' pc 505 (t/00-sanity.t:18)
151 stream = tapir.'parse_tapstream'(tap_error)
153 $I0 = stream.'is_pass'()
154 is($I0,0,"parse_tapstream does not pass a TAP stream with a death message")
156 $I0 = stream.'get_pass'()
157 is($I0,0,"parse_tapstream gets no passed tests")
159 $I0 = stream.'get_todo'()
160 is($I0,0,"parse_tapstream gets 0 todo tests")
162 $I0 = stream.'get_skip'()
163 is($I0,0,"parse_tapstream gets 0 skip tests")
165 $I0 = stream.'get_fail'()
166 is($I0,1,"parse_tapstream gets one failed test")
168 $I0 = stream.'total'()
169 is($I0,1,"parse_tapstream gets one test in total")
173 .sub test_parse_death_with_passing_tests
175 .local string tap_error
179 ok 1 - new returns a Tapir::Parser object isa Tapir;Parser
180 Class Stream already registered!
182 current instr.: 'parrot;Tapir;Stream;main' pc 495 (t/00-sanity.t:18)
184 stream = tapir.'parse_tapstream'(tap_error)
186 $I0 = stream.'is_pass'()
187 is($I0,0,"parse_tapstream does not pass a TAP stream with a death message")
189 $I0 = stream.'get_pass'()
190 is($I0,1,"parse_tapstream gets 1 passing test")
192 $I0 = stream.'get_todo'()
193 is($I0,0,"parse_tapstream gets 0 todo tests")
195 $I0 = stream.'get_skip'()
196 is($I0,0,"parse_tapstream gets 0 skip tests")
198 $I0 = stream.'get_fail'()
199 is($I0,0,"parse_tapstream gets no failing tests")
201 $I0 = stream.'total'()
202 is($I0,1,"parse_tapstream gets one test in total")
209 # vim: expandtab shiftwidth=4 ft=pir: