Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #38760] [BUG] Allow passing "todo => $reason" to Parrot::Test::example_output_(is|like|isnt)

0 views
Skip to first unread message

Bernhard Schmalhofer

unread,
Mar 19, 2006, 8:32:04 AM3/19/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Bernhard Schmalhofer
# Please include the string: [perl #38760]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38760 >


Hi,

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.

CU, Bernhard

Chromatic

unread,
Mar 19, 2006, 9:45:51 PM3/19/06
to perl6-i...@perl.org, Bernhard Schmalhofer, bugs-bi...@rt.perl.org
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.

-- c

Bernhard Schmalhofer

unread,
Mar 20, 2006, 2:16:56 PM3/20/06
to parrotbug...@parrotcode.org
chromatic via RT schrieb:

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

Chromatic

unread,
Mar 28, 2006, 2:32:26 PM3/28/06
to perl6-i...@perl.org, Bernhard Schmalhofer, parrotbug...@parrotcode.org
On Monday 20 March 2006 11:16, Bernhard Schmalhofer wrote:

> 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 );
> # }

Here's a patch that seems to fix things for me. Is it better for you,
Bernhard?

-- c

parrot_test.patch
0 new messages