Refactor library initialization code.
This commit is contained in:
@@ -55,7 +55,7 @@ public class LuaOperationsTest extends TestCase {
|
||||
private final LuaValue stringlong = LuaValue.valueOf(samplestringlong);
|
||||
private final LuaValue stringdouble = LuaValue.valueOf(samplestringdouble);
|
||||
private final LuaTable table = LuaValue.listOf( new LuaValue[] { LuaValue.valueOf("aaa"), LuaValue.valueOf("bbb") } );
|
||||
private final LuaFunction somefunc = new ZeroArgFunction("sample",0,table) { public LuaValue call() { return NONE;}};
|
||||
private final LuaValue somefunc = new ZeroArgFunction(table) { public LuaValue call() { return NONE;}};
|
||||
private final LuaThread thread = new LuaThread(somefunc,table);
|
||||
private final Prototype proto = new Prototype();
|
||||
private final LuaClosure someclosure = new LuaClosure(proto,table);
|
||||
@@ -207,7 +207,7 @@ public class LuaOperationsTest extends TestCase {
|
||||
|
||||
// function tests
|
||||
{
|
||||
LuaFunction f = new ZeroArgFunction("f",0,_G) { public LuaValue call() { return env.get("a");}};
|
||||
LuaFunction f = new ZeroArgFunction(_G) { public LuaValue call() { return env.get("a");}};
|
||||
assertEquals( aaa, f.call() );
|
||||
f.setfenv(newenv);
|
||||
assertEquals( newenv, f.getfenv() );
|
||||
|
||||
@@ -70,9 +70,9 @@ public class ScriptDrivenTest extends TestCase {
|
||||
|
||||
// override print()
|
||||
final ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
final PrintStream oldps = BaseLib.STDOUT;
|
||||
final PrintStream oldps = BaseLib.instance.STDOUT;
|
||||
final PrintStream ps = new PrintStream( output );
|
||||
BaseLib.STDOUT = ps;
|
||||
BaseLib.instance.STDOUT = ps;
|
||||
|
||||
// run the script
|
||||
try {
|
||||
@@ -85,7 +85,7 @@ public class ScriptDrivenTest extends TestCase {
|
||||
|
||||
assertEquals(expectedOutput, actualOutput);
|
||||
} finally {
|
||||
BaseLib.STDOUT = oldps;
|
||||
BaseLib.instance.STDOUT = oldps;
|
||||
ps.close();
|
||||
}
|
||||
} catch ( IOException ioe ) {
|
||||
|
||||
Reference in New Issue
Block a user