2 # Copyright (C) 2006-2007, Parrot Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 6;
13 t/pmc/io_status.t - test the Status PMC described in PDD22
17 % prove t/pmc/io_status.t
21 Tests the Status PMC described in PDD22.
25 # L<PDD22/Status Object PMC API/=item new>
26 pir_output_is( <<'CODE', <<'OUT', 'new', todo => 'not yet implemented' );
29 say "ok 1 - $P0 = new ['Status']"
32 ok 1 - $P0 = new ['Status']
35 # L<PDD22/Status Object PMC API/=item get_integer (vtable)>
36 pir_output_is( <<'CODE', <<'OUT', 'get_integer (vtable)', todo => 'not yet implemented' );
40 # TODO test more return values
41 # TODO figure out how to set the values to make testing possible
47 say 'ok 1 - $I0 = $P1 # success'
52 say 'ok 2 - $I0 = $P1 # still running'
54 if $I0 == -1 goto ok_3
57 say 'ok 3 - $I0 = $P1 # failure
60 ok 1 - $I0 = $P0 # success
61 ok 2 - $I0 = $P0 # still running
62 ok 3 - $I0 = $P0 # failure
65 # L<PDD22/Status Object PMC API/=item get_bool (vtable)>
66 pir_output_is( <<'CODE', <<'OUT', 'get_bool (vtable)', todo => 'not yet implemented' );
70 # TODO figure out how to set the values to make testing possible
75 say 'ok 1 - $P0 # success'
80 say 'ok 2 - $P0 # still running'
85 say 'ok 3 - $P0 # failure
89 ok 2 - $P0 # still running
93 # L<PDD22/Status Object PMC API/=item return>
94 pir_output_is( <<'CODE', <<'OUT', 'return', todo => 'not yet implemented' );
98 # TODO test all return values
99 # TODO figure out how to set the values to make testing possible
106 say 'ok 1 - $P0 = $P1.return() # success'
108 # TODO test return value is expected value
110 if null $P1 goto ok_2
113 say 'ok 2 - $P0 = $P1.return() # still running'
115 if null $P1 goto ok_3
118 say 'ok 3 - $P0 = $P1.return() # no return value
121 ok 1 - $P0 = $P1.return() # success
122 ok 2 - $P0 = $P1.return() # still running
123 ok 3 - $P0 = $P1.return() # no return value
126 # L<PDD22/Status Object PMC API/=item error>
127 pir_output_is( <<'CODE', <<'OUT', 'error', todo => 'not yet implemented' );
131 # TODO test all error values
132 # TODO figure out how to set the values to make testing possible
136 if null $P1 goto ok_1
139 say 'ok 1 - $P0 = $P1.error() # success'
141 $P1 = $P0.error() # need still running here
143 if null $P1 goto ok_2
146 say 'ok 2 - $P0 = $P1.error() # still running'
148 $P1 = $P0.error() # need real error here
150 unless null $P1 goto ok_3
153 say 'ok 3 - $P0 = $P1.error() # got an error'
155 $I0 = isa $P1, 'Exception'
159 say 'ok 4 - $P0 = $P1.error() # error isa Exception'
161 # TODO test error value is expected value
163 $P1 = $P0.error() # need no error here
165 if null $P1 goto ok_5
168 say 'ok 5 - $P0 = $P1.error() # no error
171 ok 1 - $P0 = $P1.error() # success
172 ok 2 - $P0 = $P1.error() # still running
173 ok 3 - $P0 = $P1.error() # got an error
174 ok 4 - $P0 = $P1.error() # error isa Exception
175 ok 5 - $P0 = $P1.error() # no error
178 # L<PDD22/Status Object PMC API/=item throw>
179 pir_output_is( <<'CODE', <<'OUT', 'throw', todo => 'not yet implemented' );
183 # TODO figure out how to set the values to make testing possible
189 say 'ok 1 - $P0.throw() # no error'
192 $P0 = new ['Status'] # need error here
198 say 'not ok 2 - $P0.throw() # error'
203 say 'not ok 1 - $P0.throw() # no error'
207 say 'ok 2 - $P0.throw() # error'
212 ok 1 - $P1.throw() # no error
213 ok 2 - $P1.throw() # error
218 # cperl-indent-level: 4
221 # vim: expandtab shiftwidth=4: