1. updated the code to use LuaErrorException and removed VMException

2. refactored debugging network communication layer
This commit is contained in:
Shu Lei
2007-11-20 23:26:50 +00:00
parent 6c9d02b3a3
commit 9f7b675220
13 changed files with 495 additions and 200 deletions

View File

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

View File

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

View File

@@ -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" };