Split libraries into pieces.

This commit is contained in:
James Roseborough
2007-11-09 00:15:56 +00:00
parent 4acaa11845
commit 2023ac3464
45 changed files with 3008 additions and 825 deletions

View File

@@ -1,18 +1,17 @@
package org.luaj.compiler;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.luaj.compiler.Compiler;
import org.luaj.debug.Print;
import org.luaj.vm.LClosure;
import org.luaj.vm.LValue;
import org.luaj.vm.LPrototype;
import org.luaj.vm.LuaState;
import junit.framework.TestCase;
import org.luaj.debug.Print;
import org.luaj.lib.BaseLib;
import org.luaj.vm.LClosure;
import org.luaj.vm.LPrototype;
import org.luaj.vm.LValue;
import org.luaj.vm.LuaState;
public class SimpleTests extends TestCase {
private void doTest( String script ) {
@@ -24,6 +23,7 @@ public class SimpleTests extends TestCase {
// try running the code!
LuaState state = new LuaState();
BaseLib.install( state._G );
LClosure c = new LClosure( state, p );
state.doCall( c, new LValue[0] );
} catch ( Exception e ) {

View File

@@ -7,7 +7,7 @@ import java.io.OutputStream;
import junit.framework.TestCase;
import org.luaj.debug.DebugLuaState;
import org.luaj.lib.MathLib;
import org.luaj.lib.BaseLib;
import org.luaj.lib.j2se.LuajavaLib;
@@ -114,11 +114,11 @@ public class LuaJTest extends TestCase {
// new lua state
LuaState state = new DebugLuaState();
// add LuaJava bindings
LuajavaLib.install(state._G);
// add LuaCompat bindings
MathLib.install(state._G);
// add standard bindings
state.installStandardLibs();
// add luajava
LuajavaLib.install( state._G );
// load the file
LPrototype p = loadScriptResource( state, testName );

View File

@@ -14,7 +14,7 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.luaj.debug.DebugLuaState;
import org.luaj.lib.MathLib;
import org.luaj.lib.BaseLib;
public class StandardTest extends TestCase {
@@ -66,7 +66,10 @@ public class StandardTest extends TestCase {
public void runTest() {
LuaState state = new DebugLuaState();
MathLib.install(state._G);
// add standard bindings
state.installStandardLibs();
// hack: it's unpleasant when the test cases fail to terminate;
// unfortunately, there is a test in the standard suite that
// relies on weak tables having their elements removed by