From a4143141148b85f2d4b4ed3221ca017a3298ce1f Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Thu, 9 Apr 2009 16:25:12 +0000 Subject: [PATCH] Add oslib tests. --- src/test/java/org/luaj/vm/CompatibiltyTest.java | 4 ++++ src/test/res/oslib.lua | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/luaj/vm/CompatibiltyTest.java b/src/test/java/org/luaj/vm/CompatibiltyTest.java index d63f1570..0755699e 100644 --- a/src/test/java/org/luaj/vm/CompatibiltyTest.java +++ b/src/test/java/org/luaj/vm/CompatibiltyTest.java @@ -116,6 +116,10 @@ public class CompatibiltyTest extends ScriptDrivenTest { runTest("next"); } + public void testOsLib() throws IOException, InterruptedException { + runTest("oslib"); + } + public void testPcalls() throws IOException, InterruptedException { runTest("pcalls"); } diff --git a/src/test/res/oslib.lua b/src/test/res/oslib.lua index d47c5f5f..a728c17c 100644 --- a/src/test/res/oslib.lua +++ b/src/test/res/oslib.lua @@ -8,7 +8,7 @@ print( 'os', os ~= nil ) print( 'os.clock()', pcall( os.clock ) ) print( 'os.date()', pcall( os.date ) ) print( 'os.difftime(123000, 21250)', pcall( os.difftime, 123000, 21250 ) ) -print( 'os.execute("ipconfig")', pcall( os.execute, 'ipconfig' ) ) +print( 'os.execute("hostname")', pcall( os.execute, 'hostname' ) ) print( 'os.execute("")', pcall( os.execute, '' ) ) print( 'os.getenv()', pcall( os.getenv ) ) print( 'os.getenv("bogus.key")', pcall( os.getenv, 'bogus.key' ) ) @@ -32,5 +32,5 @@ print( 'os.setlocale("us","monetary")', pcall( os.setlocale, "us", "monetary" ) print( 'os.setlocale(nil,"all")', pcall( os.setlocale, nil, "all" ) ) print( 'os.setlocale("c")', pcall( os.setlocale, "c" ) ) print( 'os.exit(123)' ) -print( pcall( os.exit, -123 ) ) +-- print( pcall( os.exit, -123 ) ) print( 'failed to exit' )