Send test error output to System.err
This commit is contained in:
@@ -252,9 +252,27 @@ public class LuaJTest extends TestCase {
|
|||||||
});
|
});
|
||||||
outputCopier.start();
|
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();
|
p.waitFor();
|
||||||
inputCopier.join();
|
inputCopier.join();
|
||||||
outputCopier.join();
|
outputCopier.join();
|
||||||
|
errorCopier.join();
|
||||||
|
|
||||||
return new String( baos.toByteArray() );
|
return new String( baos.toByteArray() );
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
-- object ids
|
-- object ids
|
||||||
|
package.path = "?.lua;src/test/res/?.lua"
|
||||||
require 'ids'
|
require 'ids'
|
||||||
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,{}) end) )
|
||||||
print( 'a(setmetatable(t*)) ', a(function() return sm(t,{__metatable='some string'}) 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)) ', 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!
|
-- bad args to error!
|
||||||
print( 'error("msg","arg")', a(function() error('some message', 'some bad arg') end) )
|
print( 'error("msg","arg")', a(function() error('some message', 'some bad arg') end) )
|
||||||
|
|||||||
Reference in New Issue
Block a user