Author: bernhard Date: Sat Jan 26 03:07:24 2008 New Revision: 25233 Modified: trunk/languages/cola/t/examples.t
Log: [cola] Try to make t/examples.t more portable. Modified: trunk/languages/cola/t/examples.t ============================================================================== --- trunk/languages/cola/t/examples.t (original) +++ trunk/languages/cola/t/examples.t Sat Jan 26 03:07:24 2008 @@ -1,12 +1,8 @@ #! perl + # Copyright (C) 2008, The Perl Foundation. # $Id$ -use strict; -use warnings; -use lib qw( . lib ../lib ../../lib ); -use Test::More tests => 1; - =head1 NAME cola/t/examples.t - Test examples in F<cola/examples> @@ -29,6 +25,15 @@ =cut +use strict; +use warnings; +use FindBin; +use lib "$FindBin::Bin/../../../lib"; + +use Test::More tests => 1; +use Parrot::Config; +use File::Spec (); + # Set up expected output for examples my %expected = ( 'mandelbrot' => << 'END_EXPECTED', @@ -66,9 +71,15 @@ ); +my $cola_dir = File::Spec->catfile( $FindBin::Bin, + File::Spec->updir() ); +my $parrot = File::Spec->catfile( File::Spec->updir(), + File::Spec->updir(), + $PConfig{test_prog} ); + while ( my ( $example, $expected ) = each %expected ) { - system( "cd cola ; ./colacc examples/$example.cola" ); - is( `cd cola; ../../parrot a.pir`, $expected ); + system( "cd $cola_dir; ./colacc examples/$example.cola" ); + is( `cd $cola_dir; $parrot a.pir`, $expected ); } # Local Variables: