develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34255 - trunk/languages/lua/t/Parrot/Test

From:
fperrad
Date:
December 22, 2008 13:04
Subject:
[svn:parrot] r34255 - trunk/languages/lua/t/Parrot/Test
Message ID:
20081222210408.56AF2CBA12@x12.develooper.com
Author: fperrad
Date: Mon Dec 22 13:04:07 2008
New Revision: 34255

Modified:
   trunk/languages/lua/t/Parrot/Test/Lua.pm
   trunk/languages/lua/t/Parrot/Test/Lua_lex.pm
   trunk/languages/lua/t/Parrot/Test/Luad.pm

Log:
[Lua] Test
- now, work with absolute pathname

Modified: trunk/languages/lua/t/Parrot/Test/Lua.pm
==============================================================================
--- trunk/languages/lua/t/Parrot/Test/Lua.pm	(original)
+++ trunk/languages/lua/t/Parrot/Test/Lua.pm	Mon Dec 22 13:04:07 2008
@@ -3,10 +3,6 @@
 
 package Parrot::Test::Lua;
 
-use strict;
-
-use File::Basename;
-
 require Parrot::Test;
 
 =head1 NAME
@@ -28,6 +24,8 @@
 use strict;
 use warnings;
 
+use File::Spec;
+
 sub new {
     return bless {};
 }
@@ -55,13 +53,13 @@
 
         # flatten filenames (don't use directories)
         my $lua_test = get_test_prog();
-        my $lang_fn = Parrot::Test::per_test( '.lua', $count );
-        my $pir_fn  = Parrot::Test::per_test( '.pir', $count );
-        my $lua_out_fn =
-            Parrot::Test::per_test( $lua_test eq 'lua' ? '.orig_out' : '.parrot_out', $count );
+        my $lang_fn = File::Spec->rel2abs( Parrot::Test::per_test( '.lua', $count ) );
+        my $pir_fn  = File::Spec->rel2abs( Parrot::Test::per_test( '.pir', $count ) );
+        my $lua_out_fn = File::Spec->rel2abs(
+            Parrot::Test::per_test( $lua_test eq 'lua' ? '.orig_out' : '.parrot_out', $count ) );
         my $test_prog_args = $ENV{TEST_PROG_ARGS} || q{};
         my @test_prog;
-        my $src = (defined $code) ? 'languages/' . $lang_fn : q{};
+        my $src = (defined $code) ? $lang_fn : q{};
         if ( $lua_test eq 'lua' ) {
             @test_prog = (
                 "lua $test_prog_args $src $params",
@@ -69,14 +67,14 @@
         }
         elsif ( $lua_test eq 'luac.pl' ) {
             @test_prog = (
-                "perl -Ilanguages/lua languages/lua/luac.pl $src",
-                "$self->{parrot} languages/${pir_fn} $params",
+                "perl languages/lua/luac.pl $src",
+                "$self->{parrot} ${pir_fn} $params",
             );
         }
         elsif ( $lua_test eq 'luap.pir' ) {
             @test_prog = (
-                "$self->{parrot} languages/lua/luap.pir -o languages/${pir_fn} --target=pir $src",
-                "$self->{parrot} languages/${pir_fn} $params",
+                "$self->{parrot} languages/lua/luap.pir -o ${pir_fn} --target=pir $src",
+                "$self->{parrot} ${pir_fn} $params",
             );
         }
         elsif ( $lua_test eq 'luac2pir.pir' ) {
@@ -110,7 +108,7 @@
         my $builder_func = $language_test_map{$func};
 
         # set a todo-item for Test::Builder to find
-        my $call_pkg = $self->{builder}->exported_to() || '';
+        my $call_pkg = $self->{builder}->exported_to() || q{};
 
         local *{ $call_pkg . '::TODO' } = ## no critic Variables::ProhibitConditionalDeclarations
                         \$options{todo} if defined $options{todo};

Modified: trunk/languages/lua/t/Parrot/Test/Lua_lex.pm
==============================================================================
--- trunk/languages/lua/t/Parrot/Test/Lua_lex.pm	(original)
+++ trunk/languages/lua/t/Parrot/Test/Lua_lex.pm	Mon Dec 22 13:04:07 2008
@@ -3,11 +3,6 @@
 
 package Parrot::Test::Lua_lex;
 
-use strict;
-
-use Data::Dumper;
-use File::Basename;
-
 require Parrot::Test;
 
 =head1 NAME
@@ -29,6 +24,8 @@
 use strict;
 use warnings;
 
+use File::Spec;
+
 sub new {
     return bless {};
 }
@@ -51,10 +48,10 @@
         my $params = $options{params} || q{};
 
         # flatten filenames (don't use directories)
-        my $lang_fn = Parrot::Test::per_test( '.lua', $count );
-        my $lua_out_fn = Parrot::Test::per_test( '.parrot_out', $count );
+        my $lang_fn = File::Spec->rel2abs( Parrot::Test::per_test( '.lua', $count ) );
+        my $lua_out_fn = File::Spec->rel2abs( Parrot::Test::per_test( '.parrot_out', $count ) );
         my @test_prog = (
-            "$self->{parrot} languages/lua/test_lex.pir languages/${lang_fn}",
+            "$self->{parrot} languages/lua/test_lex.pir ${lang_fn}",
         );
 
         # This does not create byte code, but lua code

Modified: trunk/languages/lua/t/Parrot/Test/Luad.pm
==============================================================================
--- trunk/languages/lua/t/Parrot/Test/Luad.pm	(original)
+++ trunk/languages/lua/t/Parrot/Test/Luad.pm	Mon Dec 22 13:04:07 2008
@@ -3,10 +3,6 @@
 
 package Parrot::Test::Luad;
 
-use strict;
-
-use File::Basename;
-
 require Parrot::Test;
 
 =head1 NAME
@@ -28,6 +24,8 @@
 use strict;
 use warnings;
 
+use File::Spec;
+
 sub new {
     return bless {};
 }
@@ -50,12 +48,12 @@
         my $params = $options{params} || q{};
 
         # flatten filenames (don't use directories)
-        my $lang_fn = Parrot::Test::per_test( '.lua', $count );
-        my $luac_fn  = Parrot::Test::per_test( '.luac', $count );
-        my $lua_out_fn = Parrot::Test::per_test( '.parrot_out', $count );
+        my $lang_fn = File::Spec->rel2abs( Parrot::Test::per_test( '.lua', $count ) );
+        my $luac_fn  = File::Spec->rel2abs( Parrot::Test::per_test( '.luac', $count ) );
+        my $lua_out_fn = File::Spec->rel2abs( Parrot::Test::per_test( '.parrot_out', $count ) );
         my @test_prog = (
-            "luac -o languages/${luac_fn} languages/${lang_fn}",
-            "$self->{parrot} languages/lua/luad.pir languages/${luac_fn}",
+            "luac -o ${luac_fn} ${lang_fn}",
+            "$self->{parrot} languages/lua/luad.pir ${luac_fn}",
         );
 
         # This does not create byte code, but lua code



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About