Forráskód Böngészése

minor flash9 fixes.

Nicolas Cannasse 18 éve
szülő
commit
ecc14e3896

+ 1 - 1
std/haxe/unit/TestCase.hx

@@ -25,7 +25,7 @@
 package haxe.unit;
 import haxe.PosInfos;
 
-class TestCase #if mt_build implements mt.Protect #end {
+class TestCase #if mt_build implements mt.Protect, #end implements haxe.Public  {
 	public var currentTest : TestStatus;
 
 	public function new( ) {

+ 2 - 6
std/haxe/unit/TestResult.hx

@@ -66,12 +66,8 @@ class TestResult {
 				buf.add(test.error);
 				buf.add("\n");
 
-				if (test.backtrace != null){
-					#if flash9
-					buf.add(Std.string(test.backtrace));
-					#else true
-					buf.add(haxe.Stack.toString(test.backtrace));
-					#end
+				if (test.backtrace != null) {
+					buf.add(test.backtrace);
 					buf.add("\n");
 				}
 

+ 13 - 7
std/haxe/unit/TestRunner.hx

@@ -45,7 +45,7 @@ class TestRunner {
 				tf.autoSize = flash.text.TextFieldAutoSize.LEFT;
 				flash.Lib.current.addChild(tf);
 			}
-			tf.text += v;
+			tf.appendText(v);
 		}
 		#else flash
 		untyped {
@@ -101,6 +101,16 @@ class TestRunner {
 		return result.success;
 	}
 
+	function getBT( e : Dynamic ) {
+		#if flash9
+		if( e != null && Std.is(e,untyped __global__["Error"] ) )
+			return e.getStackTrace();
+		return null;
+		#else true
+		return haxe.Stack.toString(haxe.Stack.exceptionStack());
+		#end
+	}
+
 	function runCase( t:TestCase ) : Void 	{
 		var old = haxe.Log.trace;
 		haxe.Log.trace = customTrace;
@@ -131,7 +141,7 @@ class TestRunner {
 					}
 				}catch ( e : TestStatus ){
 					print("F");
-					t.currentTest.backtrace = haxe.Stack.exceptionStack();
+					t.currentTest.backtrace = getBT(e);
 				}catch ( e : Dynamic ){
 					print("E");
 					#if js
@@ -143,11 +153,7 @@ class TestRunner {
 					#else true
 					t.currentTest.error = "exception thrown : "+e;
 					#end
-					t.currentTest.backtrace = haxe.Stack.exceptionStack();
-					#if flash9
-					if( e != null && Std.is(e,untyped __global__["Error"] ) )
-						t.currentTest.backtrace = e.getStackTrace();
-					#end
+					t.currentTest.backtrace = getBT(e);
 				}
 				result.add(t.currentTest);
 				t.tearDown();

+ 1 - 1
std/haxe/unit/TestStatus.hx

@@ -34,7 +34,7 @@ class TestStatus {
 	public var method : String;
 	public var classname : String;
 	public var posInfos : PosInfos;
-	public var backtrace : Array<StackItem>;
+	public var backtrace : String;
 
 	public function new() 	{
 		done = false;