1. added J2sePlatform for StandardLuaJVM to use J2SE DebugNetSupportImpl
This commit is contained in:
@@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.luaj.debug.event.DebugEventBreakpoint;
|
||||
import org.luaj.debug.event.DebugEventOutputRedirect;
|
||||
|
||||
public class DebugEventTest extends TestCase {
|
||||
public void testDebugEventSerialization() {
|
||||
@@ -34,4 +35,17 @@ public class DebugEventTest extends TestCase {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testDebugEventOutputRedirectSerialization() {
|
||||
try {
|
||||
String msg = "This is a testing message";
|
||||
DebugEventOutputRedirect redirectEvent = new DebugEventOutputRedirect(msg);
|
||||
byte[] data = SerializationHelper.serialize(redirectEvent);
|
||||
DebugEventOutputRedirect redirectEventOut = (DebugEventOutputRedirect)
|
||||
SerializationHelper.deserialize(data);
|
||||
assertEquals(msg, redirectEventOut.getOutput());
|
||||
} catch (IOException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
src/test/java/org/luaj/debug/RedirectOutputStreamTest.java
Normal file
24
src/test/java/org/luaj/debug/RedirectOutputStreamTest.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package org.luaj.debug;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.luaj.debug.event.DebugEventListener;
|
||||
|
||||
public class RedirectOutputStreamTest extends TestCase {
|
||||
public void testRedirectOutputStream() {
|
||||
RedirectOutputStream redirectOut = new RedirectOutputStream(
|
||||
new DebugEventListener(){
|
||||
public void notifyDebugEvent(DebugMessage event) {
|
||||
assertEquals(event.toString(), "outputRedirect: true\r\na");
|
||||
}
|
||||
|
||||
});
|
||||
PrintWriter writer = new PrintWriter(redirectOut);
|
||||
writer.print(true);
|
||||
writer.println();
|
||||
writer.print('a');
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user