Add test for replace bug
This commit is contained in:
@@ -10,6 +10,7 @@ public class AllTests {
|
||||
|
||||
// debug tests
|
||||
TestSuite vm = new TestSuite("VM");
|
||||
vm.addTestSuite(org.luaj.vm.LuaStateTest.class);
|
||||
vm.addTestSuite(org.luaj.vm.LoadStateTest.class);
|
||||
vm.addTestSuite(org.luaj.vm.LStringTest.class);
|
||||
vm.addTestSuite(org.luaj.vm.MathLibTest.class);
|
||||
|
||||
25
src/test/java/org/luaj/vm/LuaStateTest.java
Normal file
25
src/test/java/org/luaj/vm/LuaStateTest.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package org.luaj.vm;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.luaj.TestPlatform;
|
||||
|
||||
public class LuaStateTest extends TestCase {
|
||||
LuaState vm;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
Platform.setInstance(new TestPlatform());
|
||||
vm = Platform.newLuaState();
|
||||
}
|
||||
|
||||
public void testPushnilReplaceSettop() throws IOException {
|
||||
vm.pushnil();
|
||||
vm.replace(1);
|
||||
vm.settop(1);
|
||||
assertEquals( 1, vm.gettop() );
|
||||
assertEquals( LNil.NIL, vm.topointer(1) );
|
||||
assertEquals( LNil.NIL, vm.topointer(-1) );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user