Add test for replace bug

This commit is contained in:
James Roseborough
2008-04-18 14:45:32 +00:00
parent 79734ab679
commit 3ccfa61076
2 changed files with 26 additions and 0 deletions

View File

@@ -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);

View 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) );
}
}