1. added J2sePlatform for StandardLuaJVM to use J2SE DebugNetSupportImpl

This commit is contained in:
Shu Lei
2007-12-07 19:51:06 +00:00
parent 9cf85debad
commit f19fa165b9
11 changed files with 218 additions and 4 deletions

View File

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

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