chromatic via RT schrieb:

On Sunday 19 March 2006 05:32, Bernhard Schmalhofer wrote:

I tried to use something like:

example_output_like( "examples/benchmarks/arriter.pir",
$outputs{arriter.pit}, todo => 'syntax error' );

However the 'todo' flag is not honored. My guess is that the TODO
variable isn't set in the correct package,
or Test::Builder checks for TODO in the incorrect package.
The definition of 'correct' is anything that works.

How close is "something like" to what you typed there? Without a test description -- even an empty one -- you can't set a TODO message right now. If you used:

example_output_like( "examples/benchmarks/arriter.pir", $outputs{arriter.pit}, 'some description', todo => 'syntax error' );

... and it still didn't work, knowing which *like() function you used will help debug this further.
I have put the calls to example_output_like() and example_output_is() as comments into t/benchmarks/benchmarks.t.

       # XXX use example_output_is() and example_output_like()
       #     This does not work yet WRT to TODO
       # if ( ref $outputs{$_} eq 'Regexp' ) {
# example_output_like( "examples/benchmarks/$_", $outputs{$_}, @todo );
       # }
       # else {
# example_output_is( "examples/benchmarks/$_", $outputs{$_}, @todo );
       # }

example_output_like() calls language_output_like() which in turn calls pir_output_like() or pasm_output_like(). The description defaults to the example script name and is passed along in language_output_like(). With the Perl5 debugger I have traced execution to line 487 of lib/Parrot/Test.pm.

           # set a TODO for Test::Builder to find
           my $call_pkg = $builder->exported_to() || '';
# die Dumper( $code, $expected, $desc, \%extra, $extra{todo}, $call_pkg ) if ( keys %extra );
           local *{ $call_pkg . '::TODO' } = \$extra{todo}
               if defined $extra{todo};

$extra{todo} was the expected 'syntax error'. $call_pkg was 'main'. At this point I got confused, as
'main' is the namespace in which the code in benchmarks.t is executing.

Regards,
 Bernhard

Reply via email to