Skip to content

Commit

Permalink
[t] Add 'todo' param to 'ok' and 'nok'
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandobrito committed Jan 7, 2011
1 parent add4e13 commit f4a5cf4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
23 changes: 20 additions & 3 deletions runtime/parrot/library/Test/More.pir
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,22 @@ recording it with the optional test description in C<description>.
.sub ok
.param pmc passed
.param string description :optional
.param string description :optional
.param string todo :named("todo") :optional
.local pmc test
get_hll_global test, [ 'Test'; 'More' ], '_test'
$I0 = istrue passed
if todo goto to_do
test.'ok'( $I0, description )
goto done
to_do:
test.'todo'( $I0, description, todo )
done:
.end
=item C<nok( passed, description )>
Expand All @@ -140,16 +149,24 @@ C<passed>, recording it with the optional test description in C<description>.
=cut
.sub nok
.param pmc passed
.param string description :optional
.param pmc passed
.param string description :optional
.param string todo :named("todo") :optional
.local pmc test
get_hll_global test, [ 'Test'; 'More' ], '_test'
.local int reverse_passed
reverse_passed = isfalse passed
if todo goto to_do
test.'ok'( reverse_passed, description )
goto done
to_do:
test.'todo'( reverse_passed, description, todo )
done:
.end
=item C<is( left, right, description )>
Expand Down
23 changes: 22 additions & 1 deletion t/library/test_more.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
exports = split " ", "plan test_out test_diag test_fail test_pass test_test"
test_namespace.'export_to'(curr_namespace, exports)

plan( 117 )
plan( 121 )

test_skip()
test_todo()
test_todo_as_param()
test_ok()
test_nok()
test_is()
Expand Down Expand Up @@ -818,6 +819,26 @@ CODE

.end

.sub test_todo_as_param

test_out( 'ok 13 # TODO todo reason' )
ok( 1, 'passing test', 'todo' => 'todo reason' )
test_test( 'todo (as "ok" param) test should pass, marked as TODO' )

test_out( "not ok 14 # TODO todo reason\n\tFailed (TODO) test 'failing test'" )
ok( 0, 'failing test', 'todo' => 'todo reason' )
test_test( 'todo (as "ok" param) test should fail, marked as TODO' )

test_out( 'ok 15 # TODO todo reason' )
nok( 0, 'passing test', 'todo' => 'todo reason' )
test_test( 'todo (as "nok" param) test should pass, marked as TODO' )

test_out( "not ok 16 # TODO todo reason\n\tFailed (TODO) test 'failing test'" )
nok( 1, 'failing test', 'todo' => 'todo reason' )
test_test( 'todo (as "nok" param) test should fail, marked as TODO' )

.end

.sub test_isa_ok
.local pmc dog, terrier, daschund, Spot, Sossy

Expand Down

0 comments on commit f4a5cf4

Please sign in to comment.