public virtual void @add(global::haxe.unit.TestStatus t) { this.m_tests.@add(t); if (!(t.success)) { this.success = false; } }
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) { unchecked { switch (hash) { case 93036843: { this.currentTest = ((global::haxe.unit.TestStatus)(@value)); return(@value); } default: { return(base.__hx_setField(field, hash, @value, handleProperties)); } } } }
public virtual void runCase(global::haxe.unit.TestCase t) { global::haxe.lang.Function old = global::haxe.Log.trace; global::haxe.Log.trace = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::haxe.unit.TestRunner), "customTrace", 727446804))); global::System.Type cl = global::Type.getClass <object>(((object)(t))); global::Array <object> fields = global::Type.getInstanceFields(cl); global::haxe.unit.TestRunner.print.__hx_invoke1_o(default(double), global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Class: ", global::Type.getClassName(cl)), " ")); { int _g = 0; while ((_g < fields.length)) { string f = global::haxe.lang.Runtime.toString(fields[_g]); ++_g; string fname = f; object field = global::Reflect.field(t, f); if ((fname.StartsWith("test") && (field is global::haxe.lang.Function))) { t.currentTest = new global::haxe.unit.TestStatus(); t.currentTest.classname = global::Type.getClassName(cl); t.currentTest.method = fname; t.setup(); try { global::Reflect.callMethod(t, field, new global::Array <object>()); if (t.currentTest.done) { t.currentTest.success = true; global::haxe.unit.TestRunner.print.__hx_invoke1_o(default(double), "."); } else { t.currentTest.success = false; t.currentTest.error = "(warning) no assert"; global::haxe.unit.TestRunner.print.__hx_invoke1_o(default(double), "W"); } } catch (global::System.Exception __temp_catchallException1) { global::haxe.lang.Exceptions.exception = __temp_catchallException1; object __temp_catchall2 = __temp_catchallException1; if ((__temp_catchall2 is global::haxe.lang.HaxeException)) { __temp_catchall2 = ((global::haxe.lang.HaxeException)(__temp_catchallException1)).obj; } if ((__temp_catchall2 is global::haxe.unit.TestStatus)) { global::haxe.unit.TestStatus e = ((global::haxe.unit.TestStatus)(__temp_catchall2)); { global::haxe.unit.TestRunner.print.__hx_invoke1_o(default(double), "F"); global::Array <object> tmp = global::haxe.CallStack.exceptionStack(); t.currentTest.backtrace = global::haxe.CallStack.toString(tmp); } } else { object e1 = __temp_catchall2; global::haxe.unit.TestRunner.print.__hx_invoke1_o(default(double), "E"); string tmp1 = global::Std.@string(e1); t.currentTest.error = global::haxe.lang.Runtime.concat("exception thrown : ", tmp1); global::Array <object> tmp2 = global::haxe.CallStack.exceptionStack(); t.currentTest.backtrace = global::haxe.CallStack.toString(tmp2); } } this.result.@add(t.currentTest); t.tearDown(); } } } global::haxe.unit.TestRunner.print.__hx_invoke1_o(default(double), "\n"); global::haxe.Log.trace = old; }
public virtual string toString() { global::System.Text.StringBuilder buf_b = new global::System.Text.StringBuilder(); int failures = 0; { global::_List.ListNode <object> _g_head = this.m_tests.h; while ((_g_head != null)) { global::haxe.unit.TestStatus val = ((global::haxe.unit.TestStatus)(_g_head.item)); _g_head = _g_head.next; global::haxe.unit.TestStatus test = ((global::haxe.unit.TestStatus)(val)); if ((test.success == false)) { buf_b.Append(((string)("* "))); buf_b.Append(((string)(global::Std.@string(test.classname)))); buf_b.Append(((string)("::"))); buf_b.Append(((string)(global::Std.@string(test.method)))); buf_b.Append(((string)("()"))); buf_b.Append(((string)("\n"))); buf_b.Append(((string)("ERR: "))); if ((test.posInfos != null)) { buf_b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.getField(test.posInfos, "fileName", 1648581351, true)))))); buf_b.Append(((string)(":"))); buf_b.Append(((string)(global::Std.@string(((int)(global::haxe.lang.Runtime.getField_f(test.posInfos, "lineNumber", 1981972957, true))))))); buf_b.Append(((string)("("))); buf_b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.getField(test.posInfos, "className", 1547539107, true)))))); buf_b.Append(((string)("."))); buf_b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.getField(test.posInfos, "methodName", 302979532, true)))))); buf_b.Append(((string)(") - "))); } buf_b.Append(((string)(global::Std.@string(test.error)))); buf_b.Append(((string)("\n"))); if (!(string.Equals(test.backtrace, null))) { buf_b.Append(((string)(global::Std.@string(test.backtrace)))); buf_b.Append(((string)("\n"))); } buf_b.Append(((string)("\n"))); ++failures; } } } buf_b.Append(((string)("\n"))); if ((failures == 0)) { buf_b.Append(((string)("OK "))); } else { buf_b.Append(((string)("FAILED "))); } buf_b.Append(((string)(global::Std.@string(this.m_tests.length)))); buf_b.Append(((string)(" tests, "))); buf_b.Append(((string)(global::Std.@string(failures)))); buf_b.Append(((string)(" failed, "))); buf_b.Append(((string)(global::Std.@string((this.m_tests.length - failures))))); buf_b.Append(((string)(" success"))); buf_b.Append(((string)("\n"))); return(buf_b.ToString()); }
public static void __hx_ctor_haxe_unit_TestStatus(global::haxe.unit.TestStatus __hx_this) { __hx_this.done = false; __hx_this.success = false; }