1. updated the code to use LuaErrorException and removed VMException
2. refactored debugging network communication layer
This commit is contained in:
@@ -4,10 +4,9 @@ import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.luaj.debug.event.DebugEventType;
|
||||
import org.luaj.debug.response.DebugResponseCallgraph;
|
||||
import org.luaj.debug.response.DebugResponseSession;
|
||||
import org.luaj.debug.response.DebugResponseStack;
|
||||
import org.luaj.debug.response.DebugResponseVariables;
|
||||
import org.luaj.vm.Lua;
|
||||
|
||||
public class DebugResponseTest extends TestCase {
|
||||
@@ -62,7 +61,7 @@ public class DebugResponseTest extends TestCase {
|
||||
doTestDebugResponseCallgraphSerialization(new StackFrame[0]);
|
||||
|
||||
StackFrame[] frames = new StackFrame[1];
|
||||
frames[0] = new StackFrame(100, "test.lua");
|
||||
frames[0] = new StackFrame("test.lua", 100);
|
||||
doTestDebugResponseCallgraphSerialization(frames);
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
@@ -84,4 +83,17 @@ public class DebugResponseTest extends TestCase {
|
||||
assertEquals(inFrames[i], outFrames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void testDebugResponseSession() {
|
||||
try {
|
||||
DebugResponseSession sessionResponse = new DebugResponseSession(100);
|
||||
byte[] data = SerializationHelper.serialize(sessionResponse);
|
||||
DebugResponseSession sessionOut
|
||||
= (DebugResponseSession) SerializationHelper.deserialize(data);
|
||||
assertNotNull(sessionOut);
|
||||
assertEquals(sessionResponse.getSessionId(), sessionOut.getSessionId());
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import junit.framework.TestCase;
|
||||
public class StackFrameTest extends TestCase {
|
||||
public void testSerialization() {
|
||||
try {
|
||||
StackFrame stackIn = new StackFrame(10, "test.lua");
|
||||
StackFrame stackIn = new StackFrame("test.lua", 10);
|
||||
byte[] data = SerializationHelper.serialize(stackIn);
|
||||
StackFrame stackOut = (StackFrame) SerializationHelper.deserialize(data);
|
||||
assertNotNull(stackOut);
|
||||
|
||||
@@ -111,7 +111,6 @@ public class LuaJVMTest extends TestCase {
|
||||
vm.run();
|
||||
fail("Should never reach this line.");
|
||||
} catch (ParseException e) {}
|
||||
catch (IOException e) {}
|
||||
|
||||
// lua script cannot be found
|
||||
args = new String[] { "dummy.lua" };
|
||||
@@ -122,7 +121,7 @@ public class LuaJVMTest extends TestCase {
|
||||
fail("Bad parsing program. Should never reach this line.");
|
||||
} catch (ParseException e) {
|
||||
fail("Should never reach this line.");
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
|
||||
// valid command line
|
||||
args = new String[] { "-Dport=1044,suspendOnStart=true", "dummy.lua" };
|
||||
|
||||
Reference in New Issue
Block a user