Make compiler installed by default for standard platforms.

This commit is contained in:
James Roseborough
2010-05-14 04:00:05 +00:00
parent ceb53253fb
commit 47b33aea08
17 changed files with 37 additions and 46 deletions

View File

@@ -25,10 +25,10 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.luaj.vm2.LuaClosure;
import org.luaj.vm2.Print;
import org.luaj.vm2.Prototype;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Print;
import org.luaj.vm2.Prototype;
import org.luaj.vm2.compiler.LuaC;
import org.luaj.vm2.lib.JsePlatform;
@@ -53,7 +53,6 @@ public class TestLuaJ {
// create an environment to run in
LuaTable _G = JsePlatform.standardGlobals();
LuaC.install();
// compile into a chunk, or load as a class
InputStream is = new ByteArrayInputStream( script.getBytes() );

View File

@@ -82,7 +82,6 @@ public class CompatibiltyTest {
protected void setUp() throws Exception {
super.setUp();
System.setProperty("JME", "false");
LuaC.install();
}
}
public static class JseBytecodeTest extends CompatibiltyTestSuite {

View File

@@ -40,7 +40,6 @@ public class ErrorsTest extends ScriptDrivenTest {
protected void setUp() throws Exception {
super.setUp();
LuaC.install();
}
public void testBaseLibArgs() { runTest("baselibargs"); }

View File

@@ -196,7 +196,6 @@ public class LuaOperationsTest extends TestCase {
LuaValue aaa = LuaValue.valueOf("aaa");
LuaValue eee = LuaValue.valueOf("eee");
LuaTable _G = org.luaj.vm2.lib.JsePlatform.standardGlobals();
LuaC.install();
LuaTable newenv = LuaValue.tableOf( new LuaValue[] {
LuaValue.valueOf("a"), LuaValue.valueOf("aaa"),
LuaValue.valueOf("b"), LuaValue.valueOf("bbb"), } );

View File

@@ -44,30 +44,37 @@ public class ScriptDrivenTest extends TestCase {
private final PlatformType platform;
private final String basedir;
private LuaTable _G;
protected ScriptDrivenTest( PlatformType platform, String directory ) {
this.platform = platform;
this.basedir = directory;
initGlobals();
}
private void initGlobals() {
switch ( platform ) {
default:
case JSE:
case LUAJIT:
_G = org.luaj.vm2.lib.JsePlatform.debugGlobals();
break;
case JME:
_G = org.luaj.vm2.lib.JmePlatform.debugGlobals();
break;
}
}
protected void setUp() throws Exception {
super.setUp();
}
// */
protected void runTest(String testName) {
try {
// create globals
LuaTable _G = null;
switch ( platform ) {
default:
case JSE:
case LUAJIT:
_G = org.luaj.vm2.lib.JsePlatform.debugGlobals();
break;
case JME:
_G = org.luaj.vm2.lib.JmePlatform.debugGlobals();
break;
}
// override print()
initGlobals();
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final PrintStream oldps = BaseLib.instance.STDOUT;
final PrintStream ps = new PrintStream( output );

View File

@@ -30,7 +30,6 @@ abstract public class AbstractUnitTests extends TestCase {
protected void setUp() throws Exception {
super.setUp();
_G = JsePlatform.standardGlobals();
LuaC.install();
}
protected void doTest(String file) {

View File

@@ -32,7 +32,6 @@ public class DumpLoadEndianIntTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
_G = JsePlatform.standardGlobals();
LuaC.install();
DumpState.ALLOW_INTEGER_CASTING = false;
}

View File

@@ -22,7 +22,6 @@ public class SimpleTests extends TestCase {
protected void setUp() throws Exception {
super.setUp();
_G = JsePlatform.standardGlobals();
LuaC.install();
}
private void doTest( String script ) {

View File

@@ -24,7 +24,6 @@ public class LuaJavaCoercionTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
_G = JsePlatform.standardGlobals();
LuaC.install();
}
public void testJavaIntToLuaInt() {

View File

@@ -110,7 +110,6 @@ public class Luajvm1CompatibilityTest extends TestCase {
}
}
});
org.luaj.vm2.compiler.LuaC.install();
org.luaj.vm2.lib.BaseLib.instance.STDOUT = printStream;
_G.get("require").call(LuaValue.valueOf(test));
printStream.flush();