Author: paultcochrane
Date: Sat Jul 7 04:35:23 2007
New Revision: 19670
Modified:
trunk/languages/lua/lib/luaperl.pir
trunk/languages/lua/t/basic.t
trunk/languages/lua/t/io.t
trunk/languages/lua/t/lfs.t
trunk/languages/lua/t/package.t
Log:
[lua] Cleanup of temporary files created when test suite is run.
Modified: trunk/languages/lua/lib/luaperl.pir
==============================================================================
--- trunk/languages/lua/lib/luaperl.pir (original)
+++ trunk/languages/lua/lib/luaperl.pir Sat Jul 7 04:35:23 2007
@@ -129,11 +129,13 @@
if pir goto L1
$P0 = getclass 'ParrotIO'
$S0 = $P0.'slurp'(out)
+ unlink(out) # cleaning up the temporary file
.local pmc ex
ex = new .Exception
ex['_message'] = $S0
throw ex
L1:
+ unlink(out) # cleaning up the temporary file
.local pmc pir_comp
pir_comp = compreg 'PIR'
$P0 = pir_comp(pir)
Modified: trunk/languages/lua/t/basic.t
==============================================================================
--- trunk/languages/lua/t/basic.t (original)
+++ trunk/languages/lua/t/basic.t Sat Jul 7 04:35:23 2007
@@ -108,6 +108,9 @@
7.0880180586677
OUTPUT
+# clean up lib1.lua
+unlink('../lib1.lua') if ( -f '../lib1.lua' );
+
language_output_like( 'lua', << 'CODE', << 'OUTPUT', 'function dofile (no
file)' );
dofile("no_file.lua")
CODE
@@ -125,6 +128,9 @@
/\?/
OUTPUT
+# clean up foo.lua
+unlink('../foo.lua') if ( -f '../foo.lua' );
+
language_output_is( 'lua', <<'CODE', <<'OUT', 'function getfenv' );
local function f () end
@@ -203,6 +209,9 @@
ok
OUTPUT
+# clean up foo.lua
+unlink('../foo.lua') if ( -f '../foo.lua' );
+
language_output_like( 'lua', << 'CODE', << 'OUTPUT', 'function loadfile (no
file)' );
f, msg = loadfile("no_file.lua")
print(f, msg)
@@ -222,6 +231,9 @@
/nil\t.*\?/
OUTPUT
+# clean up foo.lua
+unlink('../foo.lua') if ( -f '../foo.lua' );
+
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'function loadstring' );
f = loadstring("i = i + 1")
i = 0
@@ -641,6 +653,9 @@
false not a back trace
OUTPUT
+# clean up temporary files
+map { unlink("../tmp1.$_") if ( -f "../tmp1.$_" ) } qw(lua pbc pir);
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Modified: trunk/languages/lua/t/io.t
==============================================================================
--- trunk/languages/lua/t/io.t (original)
+++ trunk/languages/lua/t/io.t Sat Jul 7 04:35:23 2007
@@ -149,6 +149,7 @@
CODE
/^file \((0[Xx])?[0-9A-Fa-f]+\)/
OUTPUT
+unlink('../output.new') if ( -f '../output.new' );
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'io.read *l', params => "<
file.txt" );
print(io.read("*l"))
@@ -179,6 +180,8 @@
15000000000000
1000001
OUTPUT
+# clean up number.txt
+unlink('../number.txt') if ( -f '../number.txt' );
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'io.lines filename' );
for line in io.lines("file.txt") do
@@ -358,6 +361,8 @@
true
OUTPUT
}
+# clean up file.txt
+unlink('../file.txt') if ( -f '../file.txt' );
language_output_like( 'lua', << 'CODE', << 'OUTPUT', 'file:write closed' );
f = io.open("file.out", "w")
@@ -391,6 +396,8 @@
closing file for you.
OUTPUT
}
+# clean up file.out
+unlink('../file.out') if ( -f '../file.out' );
# Local Variables:
# mode: cperl
Modified: trunk/languages/lua/t/lfs.t
==============================================================================
--- trunk/languages/lua/t/lfs.t (original)
+++ trunk/languages/lua/t/lfs.t Sat Jul 7 04:35:23 2007
@@ -207,6 +207,8 @@
/^[^:]+: [^:]+:\d+: lock: closed file\nstack traceback:\n/
OUT
+# clean up file.txt
+unlink('../file.txt') if ( -f '../file.txt' );
# Local Variables:
# mode: cperl
Modified: trunk/languages/lua/t/package.t
==============================================================================
--- trunk/languages/lua/t/package.t (original)
+++ trunk/languages/lua/t/package.t Sat Jul 7 04:35:23 2007
@@ -92,6 +92,9 @@
0 1
OUTPUT
+# clean up complex.lua
+unlink('../complex.lua') if ( -f '../complex.lua' );
+
language_output_like( 'lua', << 'CODE', << 'OUTPUT', 'function require (no
module)' );
require "no_module"
CODE
@@ -109,6 +112,9 @@
/[^:]+: error loading module 'foo' from file '.*foo.lua':\n/
OUTPUT
+# clean up foo.lua
+unlink('../foo.lua') if ( -f '../foo.lua' );
+
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'function require &
package.preload' );
foo = {}
foo.bar = 1234
@@ -139,6 +145,9 @@
OUTPUT
}
+# clean up foo.lua
+unlink('../foo.lua') if ( -f '../foo.lua' );
+
unlink('../complex.lua') if ( -f '../complex.lua' );
open $X, '>', '../complex.lua';
print {$X} << 'CODE';
@@ -182,6 +191,9 @@
0 1
OUTPUT
+# clean up complex.lua
+unlink('../complex.lua') if ( -f '../complex.lua' );
+
SKIP:
{
skip('only with Parrot', 1) if (($ENV{PARROT_LUA_TEST_PROG} || q{}) eq 'lua');
@@ -233,6 +245,10 @@
OUTPUT
}
+# clean up mod_foo.pbc and/or mod_foo.pir if necessary
+unlink('../mod_foo.pbc') if ( -f '../mod_foo.pbc' );
+unlink('../mod_foo.pir') if ( -f '../mod_foo.pir' );
+
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'table package.loaded' );
t = {}
for k in pairs(package.loaded) do
@@ -306,6 +322,9 @@
hello
OUTPUT
+# clean up temporary files
+map { unlink("../tmp1.$_") if ( -f "../tmp1.$_" ) } qw(lua pbc pir);
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4