Send test error output to System.err

This commit is contained in:
James Roseborough
2007-12-06 23:31:11 +00:00
parent e8e1aaf892
commit dc08fcbec2
2 changed files with 22 additions and 0 deletions

View File

@@ -252,9 +252,27 @@ public class LuaJTest extends TestCase {
});
outputCopier.start();
// start another thread to read output from the subprocess.
Thread errorCopier = (new Thread() {
public void run() {
try {
InputStream processError = p.getErrorStream();
try {
copy( processError, System.err );
} finally {
processError.close();
}
} catch ( IOException ioe ) {
ioe.printStackTrace();
}
}
});
errorCopier.start();
p.waitFor();
inputCopier.join();
outputCopier.join();
errorCopier.join();
return new String( baos.toByteArray() );

View File

@@ -1,4 +1,5 @@
-- object ids
package.path = "?.lua;src/test/res/?.lua"
require 'ids'
ids = {}
@@ -83,6 +84,9 @@ t = {}
print( 'a(setmetatable(t)) ', a(function() return sm(t,{}) end) )
print( 'a(setmetatable(t*)) ', a(function() return sm(t,{__metatable='some string'}) end) )
print( 'a(setmetatable(t)) ', a(function() return sm(t,{}) end) )
print( 'a(setmetatable(t,nil)) ', a(function() return sm(t,nil) end) )
print( 'a(setmetatable(t)) ', a(function() return sm(t) end) )
print( 'a(setmetatable({},"abc")) ', a(function() return sm({},'abc') end) )
-- bad args to error!
print( 'error("msg","arg")', a(function() error('some message', 'some bad arg') end) )