|
@@ -64,12 +64,21 @@ class TestRunner {
|
|
|
#elseif cpp
|
|
|
cpp.Lib.print(v);
|
|
|
#elseif js
|
|
|
- var msg = StringTools.htmlEscape(js.Boot.__string_rec(v,"")).split("\n").join("<br/>");
|
|
|
- var d = document.getElementById("haxe:trace");
|
|
|
- if( d == null )
|
|
|
- alert("haxe:trace element not found")
|
|
|
- else
|
|
|
- d.innerHTML += msg;
|
|
|
+ var msg = js.Boot.__string_rec(v,"");
|
|
|
+ var d;
|
|
|
+ if( __js__("typeof")(document) != "undefined"
|
|
|
+ && (d = document.getElementById("haxe:trace")) != null ) {
|
|
|
+ msg = msg.split("\n").join("<br/>");
|
|
|
+ d.innerHTML += StringTools.htmlEscape(msg)+"<br/>";
|
|
|
+ }
|
|
|
+ else if ( __js__("typeof process") != "undefined"
|
|
|
+ && __js__("process").stdout != null
|
|
|
+ && __js__("process").stdout.write != null)
|
|
|
+ __js__("process").stdout.write(msg); // node
|
|
|
+ else if ( __js__("typeof console") != "undefined"
|
|
|
+ && __js__("console").log != null )
|
|
|
+ __js__("console").log(msg); // document-less js (which may include a line break)
|
|
|
+
|
|
|
#elseif cs
|
|
|
var str:String = v;
|
|
|
untyped __cs__("System.Console.Write(str)");
|