Author: bernhard
Date: Wed Feb 1 12:44:27 2006
New Revision: 11400
Modified:
trunk/languages/bc/lib/Parrot/Test/Bc.pm
trunk/languages/bc/lib/Parrot/Test/Bc/Antlr2.pm
trunk/languages/bc/lib/Parrot/Test/Bc/Antlr3.pm
trunk/languages/bc/lib/Parrot/Test/Bc/Posix.pm
trunk/lib/Parrot/Test.pm
Log:
Parrot bc: Skip test of ANTLR3 implementation for
test cases which are not marked as 'with_antlr_3'.
Modified: trunk/languages/bc/lib/Parrot/Test/Bc.pm
==============================================================================
--- trunk/languages/bc/lib/Parrot/Test/Bc.pm (original)
+++ trunk/languages/bc/lib/Parrot/Test/Bc.pm Wed Feb 1 12:44:27 2006
@@ -50,12 +50,11 @@ foreach my $func ( keys %language_test_m
my $self = shift;
my ( $code, $output, $desc, %options ) = @_;
- my $count = $self->{builder}->current_test + 1;
+ my $count = $self->{builder}->current_test() + 1;
# These are the thing that depend on the actual Bc implementation
my $out_fn = $self->get_out_fn( $count, \%options );
my @test_prog = $self->get_test_prog( $count, \%options );
- $self->set_todo( \%options );
# This does not create byte code, but bc code
{
@@ -64,33 +63,38 @@ foreach my $func ( keys %language_test_m
Parrot::Test::generate_code( $code, $parrotdir, $count, $lang_fn );
}
- # STDERR is written into same output file
- # die Dumper( [EMAIL PROTECTED] );
- my $exit_code = Parrot::Test::run_command(
- [EMAIL PROTECTED],
- CD => $self->{relpath},
- STDOUT => $out_fn,
- STDERR => $out_fn
- );
+ # set a TODO for Test::Builder to find
+ my $skip_why = $self->skip_why( \%options );
+ if ( $skip_why ) {
+ $self->{builder}->skip( $skip_why );
+ } else {
+ # STDERR is written into same output file
+ my $exit_code = Parrot::Test::run_command(
+ [EMAIL PROTECTED],
+ CD => $self->{relpath},
+ STDOUT => $out_fn,
+ STDERR => $out_fn
+ );
- my $builder_func = $language_test_map{$func};
- # That's the reason for: no strict 'refs';
- my $pass = $self->{builder}->$builder_func(
- Parrot::Test::slurp_file($out_fn),
- $output,
- $desc
- );
- unless ( $pass ) {
- my $diag = '';
- my $test_prog = join ' && ', @test_prog;
- $diag .= "'$test_prog' failed with exit code $exit_code." if
$exit_code;
- $self->{builder}->diag( $diag ) if $diag;
+ my $meth = $language_test_map{$func};
+ # That's the reason for: no strict 'refs';
+ my $pass = $self->{builder}->$meth(
+ Parrot::Test::slurp_file($out_fn),
+ $output,
+ $desc
+ );
+ unless ( $pass ) {
+ my $diag = '';
+ my $test_prog = join ' && ', @test_prog;
+ $diag .= "'$test_prog' failed with exit code $exit_code." if
$exit_code;
+ $self->{builder}->diag( $diag ) if $diag;
+ }
}
# The generated files are left in the t/* directories.
- # Let 'make clean' and '.cvsignore' take care of them.
+ # Let 'make clean' and 'svn:ignore' take care of them.
- return $pass;
+ return;
}
}
Modified: trunk/languages/bc/lib/Parrot/Test/Bc/Antlr2.pm
==============================================================================
--- trunk/languages/bc/lib/Parrot/Test/Bc/Antlr2.pm (original)
+++ trunk/languages/bc/lib/Parrot/Test/Bc/Antlr2.pm Wed Feb 1 12:44:27 2006
@@ -32,7 +32,7 @@ sub get_test_prog {
-sub set_todo {
+sub skip_why {
my $self = shift;
my ( $options ) = @_;
Modified: trunk/languages/bc/lib/Parrot/Test/Bc/Antlr3.pm
==============================================================================
--- trunk/languages/bc/lib/Parrot/Test/Bc/Antlr3.pm (original)
+++ trunk/languages/bc/lib/Parrot/Test/Bc/Antlr3.pm Wed Feb 1 12:44:27 2006
@@ -6,6 +6,8 @@ use strict;
use base 'Parrot::Test::Bc';
+use Data::Dumper;
+
sub get_out_fn {
my $self = shift;
my ( $count, $options ) = @_;
@@ -25,16 +27,15 @@ sub get_test_prog {
}
-sub set_todo {
+sub skip_why {
my $self = shift;
my ( $options ) = @_;
- if ( ! $options->{with_antlr3} ) {
- # XXX make this work
- # $self->{builder}->todo_skip( 'Not implemented with ANTLR3' );
+ if ( $options->{with_antlr3} ) {
+ return;
+ } else {
+ return 'Not implemented with ANTLR3';
}
-
- return;
}
Modified: trunk/languages/bc/lib/Parrot/Test/Bc/Posix.pm
==============================================================================
--- trunk/languages/bc/lib/Parrot/Test/Bc/Posix.pm (original)
+++ trunk/languages/bc/lib/Parrot/Test/Bc/Posix.pm Wed Feb 1 12:44:27 2006
@@ -30,7 +30,7 @@ sub get_test_prog {
-sub set_todo {
+sub skip_why {
my $self = shift;
my ( $options ) = @_;
Modified: trunk/lib/Parrot/Test.pm
==============================================================================
--- trunk/lib/Parrot/Test.pm (original)
+++ trunk/lib/Parrot/Test.pm Wed Feb 1 12:44:27 2006
@@ -514,7 +514,7 @@ sub _generate_functions {
my $meth = $language_test_map{$func};
if ( my $prefix = $builtin_language_prefix{$language} ) {
my $test_func = "${package}::${prefix}_${meth}";
- &$test_func( @remaining );
+ $test_func->( @remaining );
}
else {
# TODO: $language should be the name of the test Module