Browse Source

added Cs output (fixed issue #1156)

Simon Krajewski 13 years ago
parent
commit
3a105e7a98
6 changed files with 58 additions and 30 deletions
  1. 0 18
      tests/unit/RunCpp.hx
  2. 39 0
      tests/unit/RunExe.hx
  3. 5 6
      tests/unit/RunJava.hx
  4. 9 1
      tests/unit/unit.html
  5. 3 3
      tests/unit/unit.hxml
  6. 2 2
      tests/unit/unit.hxproj

+ 0 - 18
tests/unit/RunCpp.hx

@@ -1,18 +0,0 @@
-class RunCpp {
-
-	static function main() {
-		var p = new neko.io.Process(neko.Web.getCwd()+"cpp/Test-debug",[]);
-		try {
-			while( true ) {
-				var c = p.stdout.readByte();
-				if( c == "\n".code )
-					neko.Lib.print("<br>");
-				else
-					neko.Lib.print(StringTools.htmlEscape(String.fromCharCode(c)));
-			}
-		} catch( e : haxe.io.Eof ) {
-		}
-		neko.Lib.print(StringTools.htmlEscape(p.stderr.readAll().toString()).split("\n").join("<br>"));
-	}
-
-}

+ 39 - 0
tests/unit/RunExe.hx

@@ -0,0 +1,39 @@
+class RunExe {
+
+
+static function main() {
+		/*
+		cpp: cpp/Test-debug
+		cs : cs/bin/cs
+		cs_unsafe : cs_unsafe/bin/cs_unsafe
+		*/
+		var rel_path = "";
+		if (neko.Web.isModNeko) {
+			//mod neko: use get string
+			rel_path = neko.Web.getParamsString();
+			//display similar to other tests
+			neko.Web.setHeader("Content-Type","text/plain");
+		} else {
+			//command line arg
+			var args = neko.Sys.args();
+			if (args.length > 0) rel_path = args[0];
+		}
+		
+		if (rel_path == "") {
+			neko.Lib.print("error:no path to executable specified");
+			return;
+		}
+		
+		var p = new neko.io.Process(neko.Web.getCwd() + rel_path, []);
+		
+		try {
+			while ( true ) {
+				var c = p.stdout.readByte();
+				neko.Lib.print(StringTools.htmlEscape(String.fromCharCode(c)));
+			}
+		} catch ( e : haxe.io.Eof ) {
+
+		}
+		neko.Lib.print(StringTools.htmlEscape(p.stderr.readAll().toString()));
+	}
+}

+ 5 - 6
tests/unit/RunJava.hx

@@ -1,18 +1,17 @@
 class RunJava {
 
 	static function main() {
-		var p = new neko.io.Process("java",["-jar",neko.Web.getCwd()+"/java/java.jar"]);
+		var p = new neko.io.Process("java", ["-jar", neko.Web.getCwd() + "/java/java.jar"]);
+		if( neko.Web.isModNeko )
+			neko.Web.setHeader("Content-Type","text/plain");
 		try {
 			while( true ) {
 				var c = p.stdout.readByte();
-				if( c == "\n".code )
-					neko.Lib.print("<br>");
-				else
-					neko.Lib.print(StringTools.htmlEscape(String.fromCharCode(c)));
+				neko.Lib.print(StringTools.htmlEscape(String.fromCharCode(c)));
 			}
 		} catch ( e : haxe.io.Eof ) {
 		}
-		neko.Lib.print(StringTools.htmlEscape(p.stderr.readAll().toString()).split("\n").join("<br>"));
+		neko.Lib.print(StringTools.htmlEscape(p.stderr.readAll().toString()));
 	}
 
 }

+ 9 - 1
tests/unit/unit.html

@@ -131,12 +131,20 @@ iframe {
 </div>
 <div class="window">
   <div class="label">CPP</div>
-  <div id="cpp_container" class="cont"><iframe src="runcpp.n"></iframe></div>
+  <div id="cpp_container" class="cont"><iframe src="runexe.n?cpp/Test-debug"></iframe></div>
 </div>
 <div class="window">
   <div class="label">Java</div>
   <div id="java_container" class="cont"><iframe src="runjava.n"></iframe></div>
 </div>
+<div class="window">
+  <div class="label">C#</div>
+  <div id="csharp_container" class="cont"><iframe src="runexe.n?cs/bin/cs"></iframe></div>
+</div>
+<div class="window">
+  <div class="label">C#-unsafe</div>
+  <div id="csharp_container" class="cont"><iframe src="runexe.n?cs_unsafe/bin/cs_unsafe"></iframe></div>
+</div>
 <script type="text/javascript">
 setTimeout('unit.Test.main()', 1000)
 </script>

+ 3 - 3
tests/unit/unit.hxml

@@ -3,10 +3,10 @@
 -main unit.RemotingServer
 -neko remoting.n
 
-#cpp-runner
+#exe-runner
 --next
--main RunCpp
--neko runcpp.n
+-main RunExe
+-neko runexe.n
 
 #java-runner
 --next

+ 2 - 2
tests/unit/unit.hxproj

@@ -56,12 +56,12 @@
     <hidden path="unit.js.map" />
   </hiddenPaths>
   <!-- Executed before build -->
-  <preBuildCommand>haxe unit.hxml</preBuildCommand>
+  <preBuildCommand>$(CompilerPath)/haxe unit.hxml</preBuildCommand>
   <!-- Executed after build -->
   <postBuildCommand alwaysRun="False" />
   <!-- Other project options -->
   <options>
-    <option showHiddenPaths="False" />
+    <option showHiddenPaths="True" />
     <option testMovie="OpenDocument" />
     <option testMovieCommand="http://dev.unit-tests/unit.html" />
   </options>