Make compiler installed by default for standard platforms.
This commit is contained in:
@@ -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() );
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -40,7 +40,6 @@ public class ErrorsTest extends ScriptDrivenTest {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
LuaC.install();
|
||||
}
|
||||
|
||||
public void testBaseLibArgs() { runTest("baselibargs"); }
|
||||
|
||||
@@ -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"), } );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -24,7 +24,6 @@ public class LuaJavaCoercionTest extends TestCase {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
_G = JsePlatform.standardGlobals();
|
||||
LuaC.install();
|
||||
}
|
||||
|
||||
public void testJavaIntToLuaInt() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user