Improve error reporting.
This commit is contained in:
@@ -21,7 +21,11 @@
|
||||
******************************************************************************/
|
||||
package org.luaj.vm2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.luaj.vm2.compiler.LuaC;
|
||||
import org.luaj.vm2.lib.BaseLib;
|
||||
|
||||
|
||||
/**
|
||||
@@ -42,7 +46,14 @@ public class ErrorsTest extends ScriptDrivenTest {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void testBaseLibArgs() { runTest("baselibargs"); }
|
||||
public void testBaseLibArgs() {
|
||||
BaseLib.instance.STDIN = new InputStream() {
|
||||
public int read() throws IOException {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
runTest("baselibargs");
|
||||
}
|
||||
public void testCoroutineLibArgs() { runTest("coroutinelibargs"); }
|
||||
public void testIoLibArgs() { runTest("iolibargs"); }
|
||||
public void testMathLibArgs() { runTest("mathlibargs"); }
|
||||
|
||||
@@ -68,13 +68,13 @@ public class ScriptDrivenTest extends TestCase {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
initGlobals();
|
||||
}
|
||||
|
||||
// */
|
||||
protected void runTest(String testName) {
|
||||
try {
|
||||
// override print()
|
||||
initGlobals();
|
||||
final ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
final PrintStream oldps = BaseLib.instance.STDOUT;
|
||||
final PrintStream ps = new PrintStream( output );
|
||||
|
||||
Reference in New Issue
Block a user