mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
print debug output only in failed case.
This commit is contained in:
parent
01ab665681
commit
07c18fac6b
@ -45,6 +45,10 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
|
|
||||||
private File spiderMonkeyScript;
|
private File spiderMonkeyScript;
|
||||||
|
|
||||||
|
private boolean failed;
|
||||||
|
|
||||||
|
private String textCompiled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile the given classes to a Wasm and save it to a file.
|
* Compile the given classes to a Wasm and save it to a file.
|
||||||
*
|
*
|
||||||
@ -66,19 +70,35 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
compile();
|
compile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void after() {
|
||||||
|
super.after();
|
||||||
|
if( failed ) {
|
||||||
|
System.out.println( textCompiled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void compile() throws IOException, WasmException {
|
public void compile() throws IOException, WasmException {
|
||||||
create();
|
|
||||||
wasmFile = newFile( "test.wasm" );
|
|
||||||
JWebAssembly wasm = new JWebAssembly();
|
JWebAssembly wasm = new JWebAssembly();
|
||||||
for( Class<?> clazz : classes ) {
|
for( Class<?> clazz : classes ) {
|
||||||
URL url = clazz.getResource( '/' + clazz.getName().replace( '.', '/' ) + ".class" );
|
URL url = clazz.getResource( '/' + clazz.getName().replace( '.', '/' ) + ".class" );
|
||||||
wasm.addFile( url );
|
wasm.addFile( url );
|
||||||
}
|
}
|
||||||
|
textCompiled = wasm.compileToText(); // smoke test
|
||||||
|
try {
|
||||||
|
create();
|
||||||
|
wasmFile = newFile( "test.wasm" );
|
||||||
wasm.compileToBinary( wasmFile );
|
wasm.compileToBinary( wasmFile );
|
||||||
System.out.println( wasm.compileToText() ); // smoke test
|
|
||||||
|
|
||||||
nodeScript = createScript( "nodetest.js" );
|
nodeScript = createScript( "nodetest.js" );
|
||||||
spiderMonkeyScript = createScript( "SpiderMonkeyTest.js" );
|
spiderMonkeyScript = createScript( "SpiderMonkeyTest.js" );
|
||||||
|
} catch( Exception ex ) {
|
||||||
|
System.out.println( textCompiled );
|
||||||
|
throwException( ex );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,7 +170,8 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
|
|
||||||
String actual = evalWasm( script, methodName, params );
|
String actual = evalWasm( script, methodName, params );
|
||||||
assertEquals( String.valueOf( expected ), actual );
|
assertEquals( String.valueOf( expected ), actual );
|
||||||
} catch( Exception ex ) {
|
} catch( Throwable ex ) {
|
||||||
|
failed = true;
|
||||||
throwException( ex );
|
throwException( ex );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -193,7 +214,8 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
assertEquals( errorMessage, 0, exitCode );
|
assertEquals( errorMessage, 0, exitCode );
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch( Exception ex ) {
|
} catch( Throwable ex ) {
|
||||||
|
failed = true;
|
||||||
throwException( ex );
|
throwException( ex );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user