diff --git a/runtime/parrot/library/Test/Builder/Test.pir b/runtime/parrot/library/Test/Builder/Test.pir index 405450e..458a461 100644 --- a/runtime/parrot/library/Test/Builder/Test.pir +++ b/runtime/parrot/library/Test/Builder/Test.pir @@ -323,30 +323,32 @@ Returns the TAP-compatible string representation of this test. .sub report :method .local pmc passed - .local pmc description + .local pmc reason .local pmc number .local string report - .local string number_string - .local string desc_string passed = self.'passed'() number = self.'number'() - description = self.'description'() report = '' - number_string = number - desc_string = description if passed goto PASSED report = 'not ' PASSED: concat report, 'ok ' - concat report, number_string - concat report, ' # TODO' - - unless description goto REPORT - concat report, ' ' - concat report, desc_string + $S0 = number + concat report, $S0 + concat report, ' # TODO ' + + $S0 = self.'reason'() + concat report, $S0 + + if passed goto REPORT + # Build long explanation why + report .= "\n\tFailed (TODO) test '" + $S0 = self.'description'() + report .= $S0 + report .= "'" REPORT: .return( report ) diff --git a/t/library/test_more.t b/t/library/test_more.t index cb5cc3b..e2ddefa 100644 --- a/t/library/test_more.t +++ b/t/library/test_more.t @@ -797,23 +797,23 @@ CODE .local pmc test test = new [ 'Test'; 'Builder' ] - test_out( 'ok 8 # TODO passing test' ) + test_out( 'ok 8 # TODO todo reason' ) test.'todo'( 1, 'passing test', 'todo reason' ) test_test( 'todo test should pass, marked as TODO' ) - test_out( 'not ok 9 # TODO failing test' ) + test_out( "not ok 9 # TODO todo reason\n\tFailed (TODO) test 'failing test'" ) test.'todo'( 0, 'failing test', 'todo reason' ) test_test( 'todo test should fail, marked as TODO' ) - test_out( 'ok 10 # TODO passing test' ) + test_out( 'ok 10 # TODO todo reason' ) todo( 1, 'passing test', 'todo reason' ) test_test( 'todo test should pass, marked as TODO' ) - test_out( 'not ok 11 # TODO failing test' ) + test_out( "not ok 11 # TODO todo reason\n\tFailed (TODO) test 'failing test'" ) todo( 0, 'failing test', 'todo reason' ) test_test( 'todo test should fail, marked as TODO' ) - test_out( 'not ok 12 # TODO' ) + test_out( "not ok 12 # TODO \n\tFailed (TODO) test ''" ) todo( 0 ) test_test( 'todo test with no description or reason' )