diff --git a/test/cffi/compile-neko.hxml b/test/cffi/compile-neko.hxml index 7c2e20c49..883f9ee6b 100644 --- a/test/cffi/compile-neko.hxml +++ b/test/cffi/compile-neko.hxml @@ -1,4 +1,4 @@ --cp src --main TestMain --neko bin/neko/TestMain.n --cp ../unit +-p src +-m TestMain +-L utest +--neko bin/neko/TestMain.n \ No newline at end of file diff --git a/test/cffi/compile-utf8.hxml b/test/cffi/compile-utf8.hxml index 021ec3683..f28d14588 100644 --- a/test/cffi/compile-utf8.hxml +++ b/test/cffi/compile-utf8.hxml @@ -1,5 +1,5 @@ --cp src --main TestMain --cpp bin/cpp-utf8 --cp ../unit +-p src +-m TestMain +-L utest -D disable_unicode_strings +--cpp bin/cpp-utf8 \ No newline at end of file diff --git a/test/cffi/compile.hxml b/test/cffi/compile.hxml index 1d2be32bf..769320c3b 100644 --- a/test/cffi/compile.hxml +++ b/test/cffi/compile.hxml @@ -1,4 +1,4 @@ --cp src --main TestMain --cpp bin/cpp --cp ../unit +-p src +-m TestMain +-L utest +--cpp bin/cpp \ No newline at end of file diff --git a/test/cffi/src/TestBase.hx b/test/cffi/src/TestBase.hx deleted file mode 100644 index 18465c2ef..000000000 --- a/test/cffi/src/TestBase.hx +++ /dev/null @@ -1,18 +0,0 @@ -import haxe.PosInfos; - -class TestBase extends haxe.unit.TestCase -{ - public function assertClose(inWant:Float, inGot:Float, ?c : PosInfos ) - { - assertTrue( Math.abs(inWant-inGot) < 0.001, c ); - } - - public function assertEq(inWant:T, inGot:T, ?c : PosInfos ) - { - var same = inWant==inGot; - if (!same) - trace('Expected $inWant, got $inGot'); - assertTrue(same, c); - } -} - diff --git a/test/cffi/src/TestCffi.hx b/test/cffi/src/TestCffi.hx index c2c0c302e..4d3ac6851 100644 --- a/test/cffi/src/TestCffi.hx +++ b/test/cffi/src/TestCffi.hx @@ -9,8 +9,10 @@ import neko.vm.Gc; import Loader; import haxe.io.BytesData; +import utest.Test; +import utest.Assert; -class TestCffi extends TestBase +class TestCffi extends Test { static var isBool:Dynamic->Bool = Lib.load("prime", "isBool", 1); static var isNull:Dynamic->Bool = Lib.load("prime", "isNull", 1); @@ -49,37 +51,37 @@ class TestCffi extends TestBase { cpp.Prime.nekoInit("prime"); - assertTrue( isBool!=null ); - assertTrue( isBool(true) ); - assertTrue( isBool(false) ); - assertFalse( isBool(21) ); - assertFalse( isBool("Hello") ); - assertFalse( isBool(null) ); + Assert.isTrue( isBool!=null ); + Assert.isTrue( isBool(true) ); + Assert.isTrue( isBool(false) ); + Assert.isFalse( isBool(21) ); + Assert.isFalse( isBool("Hello") ); + Assert.isFalse( isBool(null) ); - assertTrue( isNull!=null ); - assertTrue( isNull(null) ); - assertFalse( isNull(false) ); - assertFalse( isNull(32) ); - assertFalse( isNull("") ); + Assert.isTrue( isNull!=null ); + Assert.isTrue( isNull(null) ); + Assert.isFalse( isNull(false) ); + Assert.isFalse( isNull(32) ); + Assert.isFalse( isNull("") ); - assertTrue( allocNull!=null ); - assertEquals(null, allocNull() ); + Assert.isTrue( allocNull!=null ); + Assert.isNull( allocNull() ); - assertTrue( appendString!=null ); - assertTrue( bufferToString!=null ); - assertTrue( getRoot!=null ); - assertTrue( setRoot!=null ); + Assert.isTrue( appendString!=null ); + Assert.isTrue( bufferToString!=null ); + Assert.isTrue( getRoot!=null ); + Assert.isTrue( setRoot!=null ); - assertTrue( createAnon!=null ); + Assert.isTrue( createAnon!=null ); - assertFalse( valIsBuffer(null) ); - assertFalse( valIsBuffer(1) ); - assertFalse( valIsBuffer({}) ); - assertFalse( valIsBuffer("String Buf") ); + Assert.isFalse( valIsBuffer(null) ); + Assert.isFalse( valIsBuffer(1) ); + Assert.isFalse( valIsBuffer({}) ); + Assert.isFalse( valIsBuffer("String Buf") ); if (cppObjectAsDynamic!=null) - assertTrue( getObjectAsString()==null); + Assert.isTrue( getObjectAsString()==null); var anon = createAnon(); for(f in Reflect.fields(anon)) @@ -87,7 +89,7 @@ class TestCffi extends TestBase #if cpp var value:Dynamic = Reflect.field(anon, f); //trace(f + " " + Type.typeof(value) ); - assertTrue( Std.string(Type.typeof(value)) == f ); + Assert.isTrue( Std.string(Type.typeof(value)) == f ); #end } @@ -102,49 +104,49 @@ class TestCffi extends TestBase var bytes = haxe.io.Bytes.ofString(base).getData(); #if !neko - assertTrue( valIsBuffer(bytes) ); + Assert.isTrue( valIsBuffer(bytes) ); // Can't acess neko buffer from haxe code bytes = appendString(bytes,"World"); var result = bufferToString(bytes); - assertEq(result,"Hello World"); + Assert.equals(result,"Hello World"); #end - assertEq(valToString(null,1),"String:null1"); - assertEq(valToString("x",1.1),"String:x1.1"); - assertEq(valToString("Hello"," World"),"String:Hello World"); - assertEq(valToString([1],[]),"String:[1][]"); + Assert.equals(valToString(null,1),"String:null1"); + Assert.equals(valToString("x",1.1),"String:x1.1"); + Assert.equals(valToString("Hello"," World"),"String:Hello World"); + Assert.equals(valToString([1],[]),"String:[1][]"); - assertEq(subBuffer("hello",4),"Cold as hell"); + Assert.equals(subBuffer("hello",4),"Cold as hell"); #if !neko - assertEq(charString(99,97,116),"A cat"); + Assert.equals(charString(99,97,116),"A cat"); #end var bytes = haxe.io.Bytes.ofString("String Buffer"); - assertEq( byteDataSize(bytes), 13 ); - assertEq( byteDataByte(bytes,1), 't'.code ); + Assert.equals( byteDataSize(bytes), 13 ); + Assert.equals( byteDataByte(bytes,1), 't'.code ); - assertEq( getAbstractFreeCount(), 0 ); + Assert.equals( getAbstractFreeCount(), 0 ); var createdAbs = createAbstract(); - assertTrue( createdAbs!=null ); - assertEq( getAbstract(createdAbs), 99 ); + Assert.notNull( createdAbs ); + Assert.equals( getAbstract(createdAbs), 99 ); // Explicitly freeing abstract does not call finalizer freeAbstract( createdAbs ); - assertEq( getAbstractFreeCount(), 0 ); - assertEq( getAbstract(createdAbs), -1 ); - assertEq( getAbstractFreeCount(), 0 ); + Assert.equals( getAbstractFreeCount(), 0 ); + Assert.equals( getAbstract(createdAbs), -1 ); + Assert.equals( getAbstractFreeCount(), 0 ); createdAbs = null; Gc.run(true); - assertEq( getAbstractFreeCount(), 0 ); + Assert.equals( getAbstractFreeCount(), 0 ); var allocatedAbs = allocAbstract(); - assertTrue( allocatedAbs!=null ); - assertEq( getAbstract(allocatedAbs), 99 ); - assertEq( getAbstractFreeCount(), 0 ); + Assert.notNull( allocatedAbs ); + Assert.equals( getAbstract(allocatedAbs), 99 ); + Assert.equals( getAbstractFreeCount(), 0 ); freeAbstract( allocatedAbs ); - assertEq( getAbstract(allocatedAbs), -1 ); - assertEq( getAbstractFreeCount(), 0 ); + Assert.equals( getAbstract(allocatedAbs), -1 ); + Assert.equals( getAbstractFreeCount(), 0 ); allocatedAbs = null; @@ -160,14 +162,14 @@ class TestCffi extends TestBase } for(i in 0...100) - assertEq( getRoot(i)+"", [i]+"" ); + Assert.equals( getRoot(i)+"", [i]+"" ); clearRoots(); for(i in 0...100) - assertEq( getRoot(i), null ); + Assert.isNull( getRoot(i) ); - assertEq( getAbstractFreeCount(), 2 ); + Assert.equals( getAbstractFreeCount(), 2 ); } function clearStack(count:Int, ?nothing:Dynamic):Dynamic diff --git a/test/cffi/src/TestMain.hx b/test/cffi/src/TestMain.hx index 3a7f07ed5..78c8083ab 100644 --- a/test/cffi/src/TestMain.hx +++ b/test/cffi/src/TestMain.hx @@ -3,14 +3,7 @@ class TestMain { public static function main() { - var r = new haxe.unit.TestRunner(); - r.add(new TestCffi()); - r.add(new TestPrime()); - - var t0 = haxe.Timer.stamp(); - var success = r.run(); - trace(" Time : " + (haxe.Timer.stamp()-t0)*1000 ); - Sys.exit(success ? 0 : 1); + utest.UTest.run([ new TestCffi(), new TestPrime() ]); } } diff --git a/test/cffi/src/TestPrime.hx b/test/cffi/src/TestPrime.hx index a628f3a8e..2f3991828 100644 --- a/test/cffi/src/TestPrime.hx +++ b/test/cffi/src/TestPrime.hx @@ -1,6 +1,7 @@ +import utest.Assert; +import utest.Test; - -class TestPrime extends TestBase +class TestPrime extends Test { static var add = Loader.load("addInts", "iii" ); #if cpp @@ -28,51 +29,51 @@ class TestPrime extends TestBase { cpp.Prime.nekoInit("prime"); - assertTrue(add!=null); - assertEquals(7, add(2,5)); + Assert.notNull(add); + Assert.equals(7, add(2,5)); #if cpp printString("Hello World"); #end var len = distance3d(3,4,5); - assertClose(50,len*len); + Assert.floatEquals(50,len*len, 0.001); fields( { x:11, name:"Hello" } ); fields( null ); - assertEquals("Ok", stringVal("HxString")); + Assert.equals("Ok", stringVal("HxString")); - assertEquals(null, getNullString()); + Assert.isNull(getNullString()); - assertEquals( ""+[1], ""+select(0, [1], "Hello", {x:1}, add) ); + Assert.equals( ""+[1], ""+select(0, [1], "Hello", {x:1}, add) ); var shouldBeNull:String = "" + select(0, null, "Hello", {x:1}, add); trace( "null ?" + shouldBeNull + "/" + shouldBeNull.length ); - assertEquals( "null", shouldBeNull ); - //assertEquals( "null", ""+select(0, null, "Hello", {x:1}, add) ); - assertEquals( ""+"Hello", ""+select(1, [1], "Hello", {x:1}, add)); - assertEquals( ""+{x:1}, ""+select(2, [1], "Hello", {x:1}, add) ); - assertEquals( ""+add, ""+select(3, [1], "Hello", {x:1}, add) ); + Assert.equals( "null", shouldBeNull ); + //Assert.equals( "null", ""+select(0, null, "Hello", {x:1}, add) ); + Assert.equals( ""+"Hello", ""+select(1, [1], "Hello", {x:1}, add)); + Assert.equals( ""+{x:1}, ""+select(2, [1], "Hello", {x:1}, add) ); + Assert.equals( ""+add, ""+select(3, [1], "Hello", {x:1}, add) ); - assertClose( 7.3, floats(true,4.2,3.1) ); - assertClose( 1.1, floats(false,4.2,3.1) ); + Assert.floatEquals( 7.3, floats(true,4.2,3.1), 0.001 ); + Assert.floatEquals( 1.1, floats(false,4.2,3.1), 0.001 ); - assertEquals( 5, multi5(1,1,1,1,1) ); - assertEquals( 6, multi6(1,1,1,1,1,1) ); - assertEquals( 7, multi7(1,1,1,1,1,1,1) ); - assertEquals( 8, multi8(1,1,1,1,1,1,1,1) ); - assertEquals( 9, multi9(1,1,1,1,1,1,1,1,1) ); - assertEquals( 10, multi10(1,1,1,1,1,1,1,1,1,1) ); - assertEquals( 11, multi11(1,1,1,1,1,1,1,1,1,1,1) ); - assertEquals( 12, multi12(1,1,1,1,1,1,1,1,1,1,1,1) ); + Assert.equals( 5, multi5(1,1,1,1,1) ); + Assert.equals( 6, multi6(1,1,1,1,1,1) ); + Assert.equals( 7, multi7(1,1,1,1,1,1,1) ); + Assert.equals( 8, multi8(1,1,1,1,1,1,1,1) ); + Assert.equals( 9, multi9(1,1,1,1,1,1,1,1,1) ); + Assert.equals( 10, multi10(1,1,1,1,1,1,1,1,1,1) ); + Assert.equals( 11, multi11(1,1,1,1,1,1,1,1,1,1,1) ); + Assert.equals( 12, multi12(1,1,1,1,1,1,1,1,1,1,1,1) ); var s0 = "hello"; var s1 = "こんにちは"; - assertTrue( addStrings(s0,s0) == s0+s0 ); + Assert.isTrue( addStrings(s0,s0) == s0+s0 ); var s01 = addStrings(s0,s1); - assertTrue( s01 == s0+s1 ); + Assert.isTrue( s01 == s0+s1 ); var s11 = addStrings(s1,s1); - assertTrue( s11 == s1+s1 ); + Assert.isTrue( s11 == s1+s1 ); } } diff --git a/test/cppia/compile-client.hxml b/test/cppia/compile-client.hxml index 39f465615..4c9c3e0c5 100644 --- a/test/cppia/compile-client.hxml +++ b/test/cppia/compile-client.hxml @@ -1,4 +1,3 @@ --main Client +-m Client -D dll_import=host_classes.info --cppia bin/client.cppia --cp ../unit +--cppia bin/client.cppia \ No newline at end of file diff --git a/test/cppia/compile-host.hxml b/test/cppia/compile-host.hxml index 93197cd62..0c39f79c5 100644 --- a/test/cppia/compile-host.hxml +++ b/test/cppia/compile-host.hxml @@ -1,6 +1,5 @@ --main CppiaHost +-m CppiaHost -D scriptable -D dll_export=host_classes.info --dce no --cpp bin --cp ../unit +--dce no +--cpp bin \ No newline at end of file diff --git a/test/debugger/compile.hxml b/test/debugger/compile.hxml index 8898b6b16..a14492f92 100644 --- a/test/debugger/compile.hxml +++ b/test/debugger/compile.hxml @@ -1,6 +1,5 @@ --main App --cpp bin +-m App -D hxcpp_debugger -D HXCPP_DEBUGGER --debug --cp ../unit +--cpp bin +--debug \ No newline at end of file diff --git a/test/extern-lib/compile-api.hxml b/test/extern-lib/compile-api.hxml index 492f03b90..7b22d2fe3 100644 --- a/test/extern-lib/compile-api.hxml +++ b/test/extern-lib/compile-api.hxml @@ -1,4 +1,3 @@ --cpp gen-externs +--cpp gen-externs -D static_link -api.HaxeApi --cp ../unit +api.HaxeApi \ No newline at end of file diff --git a/test/haxe/TestIntHash.hx b/test/haxe/TestIntHash.hx index 125839594..cd28b10a8 100644 --- a/test/haxe/TestIntHash.hx +++ b/test/haxe/TestIntHash.hx @@ -1,4 +1,7 @@ -class TestIntHash extends haxe.unit.TestCase +import utest.Test; +import utest.Assert; + +class TestIntHash extends Test { function spamAlot() { @@ -51,16 +54,9 @@ class TestIntHash extends haxe.unit.TestCase public function test() { - var err = ""; - try - { - spamAlot(); - } - catch(e:String) - { - err = e; - } - assertTrue(err==""); + spamAlot(); + + Assert.pass(); } } diff --git a/test/haxe/TestKeywords.hx b/test/haxe/TestKeywords.hx index 811a1987b..746565b3d 100644 --- a/test/haxe/TestKeywords.hx +++ b/test/haxe/TestKeywords.hx @@ -1,3 +1,6 @@ +import utest.Test; +import utest.Assert; + private enum GnarlyEnum { e0; @@ -16,7 +19,7 @@ private enum GnarlyEnum getObject(i:Int); } -class TestKeywords extends haxe.unit.TestCase +class TestKeywords extends Test { public function new() super(); @@ -44,6 +47,6 @@ class TestKeywords extends haxe.unit.TestCase case getObject(i): 1; default: 0; } - assertTrue(count==3); + Assert.equals(3, count); } } diff --git a/test/haxe/TestMain.hx b/test/haxe/TestMain.hx index d94a50662..8aefcf24b 100644 --- a/test/haxe/TestMain.hx +++ b/test/haxe/TestMain.hx @@ -1,4 +1,7 @@ package; + +import utest.Runner; +import utest.ui.Report; import gc.TestGC; class TestMain #if nme extends nme.display.Sprite #end { @@ -12,33 +15,35 @@ class TestMain #if nme extends nme.display.Sprite #end { passes = Std.parseInt(args[0]); #end - var r = new haxe.unit.TestRunner(); - r.add(new TestTypes()); - r.add(new TestKeywords()); - r.add(new TestSort()); - r.add(new TestGC()); + final runner = new Runner(); + runner.addCase(new TestTypes()); + runner.addCase(new TestKeywords()); + runner.addCase(new TestSort()); + runner.addCase(new TestGC()); #if !nme - r.add(new gc.TestGCThreaded()); + runner.addCase(new gc.TestGCThreaded()); #end - r.add(new TestIntHash()); - r.add(new TestStringHash()); - r.add(new TestObjectHash()); - r.add(new TestWeakHash()); + runner.addCase(new TestIntHash()); + runner.addCase(new TestStringHash()); + runner.addCase(new TestObjectHash()); + runner.addCase(new TestWeakHash()); #if !nme - r.add(new file.TestFile()); + runner.addCase(new file.TestFile()); #end #if cpp - r.add(new native.TestFinalizer()); + runner.addCase(new native.TestFinalizer()); #end + final report = Report.create(runner); + + runner.run(); + for(i in 0...passes) { var t0 = haxe.Timer.stamp(); - var success = r.run(); + runner.run(); trace(" Time : " + (haxe.Timer.stamp()-t0)*1000 ); - if (!success) - return 1; } return 0; } @@ -63,13 +68,23 @@ class TestMain #if nme extends nme.display.Sprite #end { } - static function endTest(error:Int) trace(error==0 ? "All tests OK" : "Tests Failed!"); #else public static function main() { - Sys.exit(runTests()); + utest.UTest.run([ + new TestTypes(), + new TestKeywords(), + new TestSort(), + new TestGC(), + new gc.TestGCThreaded(), + new TestIntHash(), + new TestStringHash(), + new TestObjectHash(), + new TestWeakHash(), + new file.TestFile(), + new native.TestFinalizer() + ]); } - public static function endTest(error:Int) Sys.exit(error); #end } diff --git a/test/haxe/TestObjectHash.hx b/test/haxe/TestObjectHash.hx index f9a95427d..0988c575e 100644 --- a/test/haxe/TestObjectHash.hx +++ b/test/haxe/TestObjectHash.hx @@ -1,11 +1,13 @@ +import utest.Test; +import utest.Assert; + class ObjectData { public var id:Int; public function new(inId:Int) id = inId; } - -class TestObjectHash extends haxe.unit.TestCase +class TestObjectHash extends Test { function spamAlot() { @@ -75,17 +77,9 @@ class TestObjectHash extends haxe.unit.TestCase public function test() { - var err = ""; - try - { - spamAlot(); - } - catch(e:Dynamic) - { - trace(e); - err = e; - } - assertTrue(err==""); + spamAlot(); + + Assert.pass(); } } diff --git a/test/haxe/TestSort.hx b/test/haxe/TestSort.hx index 6e658942c..f722b93cc 100644 --- a/test/haxe/TestSort.hx +++ b/test/haxe/TestSort.hx @@ -1,3 +1,6 @@ +import utest.Test; +import utest.Assert; + class SortData { public var value:Int; @@ -11,8 +14,7 @@ class SortData } } - -class TestSort extends haxe.unit.TestCase +class TestSort extends Test { public function testObjects() { @@ -54,7 +56,7 @@ class TestSort extends haxe.unit.TestCase throw "Not stable sort"; } - assertTrue(true); + Assert.pass(); } } diff --git a/test/haxe/TestStringHash.hx b/test/haxe/TestStringHash.hx index c9894a9b9..2cdaa3635 100644 --- a/test/haxe/TestStringHash.hx +++ b/test/haxe/TestStringHash.hx @@ -1,4 +1,7 @@ -class TestStringHash extends haxe.unit.TestCase +import utest.Test; +import utest.Assert; + +class TestStringHash extends Test { function spamAlot() { @@ -72,17 +75,9 @@ class TestStringHash extends haxe.unit.TestCase public function test() { - var err = ""; - try - { - spamAlot(); - } - catch(e:Dynamic) - { - trace(e); - err = e; - } - assertTrue(err==""); + spamAlot(); + + Assert.pass(); } } diff --git a/test/haxe/TestTypes.hx b/test/haxe/TestTypes.hx index 977ef071a..55075a889 100644 --- a/test/haxe/TestTypes.hx +++ b/test/haxe/TestTypes.hx @@ -1,4 +1,7 @@ -class TestTypes extends haxe.unit.TestCase +import utest.Test; +import utest.Assert; + +class TestTypes extends Test { var i0:Int = 1; var i1:cpp.Int32 = 1; @@ -30,20 +33,20 @@ class TestTypes extends haxe.unit.TestCase public function testConstCharStar() { var ccs = stringToCcs("hello"); - assertTrue( ccsToString(ccs)=="hello" ); - assertTrue( ccsToStringCast(ccs)=="hello" ); + Assert.equals( ccsToString(ccs), "hello" ); + Assert.equals( ccsToStringCast(ccs), "hello" ); } public function testDynamic() { var d:Dynamic = this; - assertTrue(d.i0==1); - assertTrue(d.i1==1); - assertTrue(d.i2==1); - assertTrue(d.i3==1); - assertTrue(d.i4==1); - assertTrue(d.i5==1); - assertTrue(d.i6==1); - assertTrue(d.i7==1); + Assert.equals(d.i0, 1); + Assert.equals(d.i1, 1); + Assert.equals(d.i2, 1); + Assert.equals(d.i3, 1); + Assert.equals(d.i4, 1); + Assert.equals(d.i5, 1); + Assert.equals(d.i6, 1); + Assert.equals(d.i7, 1); } } diff --git a/test/haxe/TestWeakHash.hx b/test/haxe/TestWeakHash.hx index 73316e5ae..8b8217646 100644 --- a/test/haxe/TestWeakHash.hx +++ b/test/haxe/TestWeakHash.hx @@ -1,3 +1,5 @@ +import utest.Test; +import utest.Assert; import haxe.ds.WeakMap; class WeakObjectData @@ -7,8 +9,7 @@ class WeakObjectData public function toString() return "Data " + id; } - -class TestWeakHash extends haxe.unit.TestCase +class TestWeakHash extends Test { var retained:Array; @@ -52,7 +53,7 @@ class TestWeakHash extends haxe.unit.TestCase trace("Too many odd values retained " + oddFound); if (!(valid>=expect && valid=expect && valid=expect && valid, expect:Int) { @@ -72,22 +73,14 @@ class TestWeakHash extends haxe.unit.TestCase public function test() { - var err = ""; - try - { - var map = createMapDeep(20,1000); - cpp.vm.Gc.run(true); - deepCheckMap(10,map,500); - deepClearRetained(10); - cpp.vm.Gc.run(true); - checkMap(map,0); - } - catch(e:String) - { - trace(e); - err = e; - } - assertTrue(err==""); + final map = createMapDeep(20,1000); + cpp.vm.Gc.run(true); + deepCheckMap(10,map,500); + deepClearRetained(10); + cpp.vm.Gc.run(true); + checkMap(map,0); + + Assert.pass(); } } diff --git a/test/haxe/compile.hxml b/test/haxe/compile.hxml index 7ad2370f5..2a23d789e 100644 --- a/test/haxe/compile.hxml +++ b/test/haxe/compile.hxml @@ -1,5 +1,5 @@ --cpp bin --main TestMain --resource TestMain.hx +-m TestMain +-r TestMain.hx -D HXCPP_GC_GENERATIONAL --cp ../unit +-L utest +--cpp bin \ No newline at end of file diff --git a/test/haxe/compile_nme.nmml b/test/haxe/compile_nme.nmml index 8e2bed2e4..7fe4f5380 100644 --- a/test/haxe/compile_nme.nmml +++ b/test/haxe/compile_nme.nmml @@ -25,10 +25,9 @@ /> + - - diff --git a/test/haxe/file/TestFile.hx b/test/haxe/file/TestFile.hx index 6ad2ac869..c9a1009d8 100644 --- a/test/haxe/file/TestFile.hx +++ b/test/haxe/file/TestFile.hx @@ -1,10 +1,12 @@ package file; -class TestFile extends haxe.unit.TestCase +import utest.Test; +import utest.Assert; + +class TestFile extends Test { public function testGetContentEmptyFile() { - assertEquals('', sys.io.File.getContent('./file/empty.txt')); + Assert.equals('', sys.io.File.getContent('./file/empty.txt')); } - -} +} \ No newline at end of file diff --git a/test/haxe/gc/TestGC.hx b/test/haxe/gc/TestGC.hx index deea8f3ef..20b39e98d 100644 --- a/test/haxe/gc/TestGC.hx +++ b/test/haxe/gc/TestGC.hx @@ -1,4 +1,7 @@ package gc; + +import utest.Test; +import utest.Assert; import haxe.io.Bytes; import cpp.vm.Gc; @@ -6,7 +9,7 @@ class CustomObject { public function new():Void {} } -class TestGC extends haxe.unit.TestCase { +class TestGC extends Test { function createDummy(val:Dynamic):Dynamic { return { dummy: val }; } @@ -38,10 +41,10 @@ class TestGC extends haxe.unit.TestCase { } public function testObject():Void { create(createAbc); - var zombie = gc(); - assertTrue(zombie != null); - assertEquals("abc", zombie.test); - assertTrue(gc() == null); + var zombie:Dynamic = gc(); + Assert.notNull(zombie); + Assert.equals("abc", zombie.test); + Assert.isNull(gc()); } // Null for numbers < 256 are special cases @@ -66,10 +69,10 @@ class TestGC extends haxe.unit.TestCase { }; public function testFunc():Void { create(createFunction); - var zombie = gc(); - assertTrue(zombie != null); - assertEquals("abc", zombie()); - assertTrue(gc() == null); + var zombie:Dynamic = gc(); + Assert.notNull(zombie); + Assert.equals("abc", zombie()); + Assert.isNull(gc()); } function createCustom():Void { @@ -79,9 +82,9 @@ class TestGC extends haxe.unit.TestCase { public function testCustomObject():Void { create(createCustom); var zombie = gc(); - assertTrue(zombie != null); - assertTrue(Std.isOfType(zombie, CustomObject)); - assertTrue(gc() == null); + Assert.notNull(zombie); + Assert.isOfType(zombie, CustomObject); + Assert.isNull(gc()); } function createBytes():Void { @@ -91,39 +94,39 @@ class TestGC extends haxe.unit.TestCase { public function testBytes():Void { create(createBytes); var zombie = gc(); - assertTrue(zombie != null); - assertTrue(Std.isOfType(zombie, Bytes)); - assertTrue(gc() == null); + Assert.notNull(zombie); + Assert.isOfType(zombie, Bytes); + Assert.isNull(gc()); } public function testBigStack():Void { - assertTrue( TestBigStack.test() ); - } + Assert.isTrue( TestBigStack.test() ); + } #if !cppia public function testConstStrings():Void { - // Const strings void Gc overhead - var strings = new Array(); - strings.push( haxe.Resource.getString("TestMain.hx") ); - strings.push( "some string" ); - var chars = "abc123"; - // Optimization for single chars... - for(c in 0...chars.length) - strings.push( chars.substr(c,1) ); - for(string in strings) - assertTrue( untyped __global__.__hxcpp_is_const_string(string) ); - Gc.run(true); - for(string in strings) - assertTrue( untyped __global__.__hxcpp_is_const_string(string) ); + // Const strings void Gc overhead + var strings = new Array(); + strings.push( haxe.Resource.getString("TestMain.hx") ); + strings.push( "some string" ); + var chars = "abc123"; + // Optimization for single chars... + for(c in 0...chars.length) + strings.push( chars.substr(c,1) ); + for(string in strings) + Assert.isTrue( untyped __global__.__hxcpp_is_const_string(string) ); + Gc.run(true); + for(string in strings) + Assert.isTrue( untyped __global__.__hxcpp_is_const_string(string) ); - var strings = new Array(); - strings.push( haxe.Resource.getString("TestMain.hx").substr(10) ); - strings.push( "some string" + chars ); - for(c in 0...chars.length-1) - strings.push( chars.substr(c,2) ); + var strings = new Array(); + strings.push( haxe.Resource.getString("TestMain.hx").substr(10) ); + strings.push( "some string" + chars ); + for(c in 0...chars.length-1) + strings.push( chars.substr(c,2) ); - for(string in strings) - assertFalse( untyped __global__.__hxcpp_is_const_string(string) ); + for(string in strings) + Assert.isFalse( untyped __global__.__hxcpp_is_const_string(string) ); } #end } diff --git a/test/haxe/gc/TestGCThreaded.hx b/test/haxe/gc/TestGCThreaded.hx index f35c686a3..00eab6bae 100644 --- a/test/haxe/gc/TestGCThreaded.hx +++ b/test/haxe/gc/TestGCThreaded.hx @@ -1,4 +1,7 @@ package gc; + +import utest.Test; +import utest.Assert; import haxe.io.Bytes; import haxe.crypto.Md5; import cpp.vm.Gc; @@ -18,7 +21,7 @@ class Wrapper @:cppInclude("./ZoneTest.cpp") @:depend("./ZoneTest.cpp") -class TestGCThreaded extends haxe.unit.TestCase +class TestGCThreaded extends Test { @:keep static var keepRunning = false; @@ -27,7 +30,7 @@ class TestGCThreaded extends haxe.unit.TestCase var bigText:String; - override public function setup() + function setup() { var lines = [ for(i in 0...100000) "abc123\n" ]; #if nme @@ -42,10 +45,9 @@ class TestGCThreaded extends haxe.unit.TestCase startNative(); doThreadedWork(4,100); stopNative(); - assertTrue(true); + Assert.pass(); } - public function testThreadMany():Void { startNative(); @@ -56,7 +58,7 @@ class TestGCThreaded extends haxe.unit.TestCase doThreadedWork(100,100); #end stopNative(); - assertTrue(true); + Assert.pass(); } @:native("nativeLoop") @@ -122,7 +124,7 @@ class TestGCThreaded extends haxe.unit.TestCase for(w in a) sum += w.a; - assertTrue(sum==100000); + Assert.equals(100000, sum); } main.sendMessage('done'); }) ); diff --git a/test/haxe/native/TestFinalizer.hx b/test/haxe/native/TestFinalizer.hx index e7997bd2e..8d057e2ec 100644 --- a/test/haxe/native/TestFinalizer.hx +++ b/test/haxe/native/TestFinalizer.hx @@ -1,5 +1,8 @@ package native; +import utest.Test; +import utest.Assert; + @:native("ExternStruct") extern class ExternStruct { @@ -78,10 +81,10 @@ class MyFinalizable extends cpp.Finalizable } -class TestFinalizer extends haxe.unit.TestCase +class TestFinalizer extends Test { - override public function setup() + function setup() { MyFinalizable.count = 0; CustomFinalizable.count = 0; @@ -105,7 +108,7 @@ class TestFinalizer extends haxe.unit.TestCase cpp.vm.Gc.run(true); } Sys.println("\nExtern instances remaining:" + ExternWrapper.instances); - assertTrue( ExternWrapper.instances < 10 ); + Assert.isTrue( ExternWrapper.instances < 10 ); } function createCustomFinalizable(i:Int) @@ -123,7 +126,7 @@ class TestFinalizer extends haxe.unit.TestCase createCustomFinalizable(2); cpp.vm.Gc.run(true); Sys.println("custom cleared:" + CustomFinalizable.count); - assertTrue(CustomFinalizable.count>0); + Assert.isTrue(CustomFinalizable.count>0); } #end @@ -142,7 +145,7 @@ class TestFinalizer extends haxe.unit.TestCase createMyFinalizable(2); cpp.vm.Gc.run(true); Sys.println("MyFinalizable cleared:" + MyFinalizable.count); - assertTrue(MyFinalizable.count>0); + Assert.isTrue(MyFinalizable.count>0); } } diff --git a/test/native/compile.hxml b/test/native/compile.hxml index 6aa767cae..b2e405bb7 100644 --- a/test/native/compile.hxml +++ b/test/native/compile.hxml @@ -1,5 +1,4 @@ -m Native -D HXCPP_DEBUGGER --p ../unit -L utest --cpp bin \ No newline at end of file diff --git a/test/std/compile32.hxml b/test/std/compile32.hxml index d483051ce..692ed7581 100644 --- a/test/std/compile32.hxml +++ b/test/std/compile32.hxml @@ -1,7 +1,6 @@ --main Test --cpp cpp32 +-m Test -D HXCPP_M32 -D HXCPP_DEBUGGER --cp ../unit --lib hx4compat --lib utest \ No newline at end of file +-L hx4compat +-L utest +--cpp cpp32 \ No newline at end of file diff --git a/test/std/compile64.hxml b/test/std/compile64.hxml index 08d70bdef..2793e6bd3 100644 --- a/test/std/compile64.hxml +++ b/test/std/compile64.hxml @@ -1,6 +1,5 @@ --main Test --cpp cpp64 +-m Test -D HXCPP_M64 --cp ../unit --lib hx4compat --lib utest \ No newline at end of file +-L hx4compat +-L utest +--cpp cpp64 \ No newline at end of file diff --git a/test/std/testAndroid.hxml b/test/std/testAndroid.hxml index 95dcad2be..7e7e1d0b6 100644 --- a/test/std/testAndroid.hxml +++ b/test/std/testAndroid.hxml @@ -1,10 +1,9 @@ --main Test --cpp arm32 +-m Test -D android -D exe_link --cp ../unit --lib hx4compat --lib utest --cmd adb push arm32/Test /storage/ext_sd --cmd adb push Test.hx /storage/ext_sd --cmd adb shell "cd /storage/ext_sd && ./Test" +-L hx4compat +-L utest +--cmd adb push arm32/Test /storage/ext_sd +--cmd adb push Test.hx /storage/ext_sd +--cmd adb shell "cd /storage/ext_sd && ./Test" +--cpp arm32 \ No newline at end of file diff --git a/test/telemetry/compile.hxml b/test/telemetry/compile.hxml index 7562c3b50..758233838 100644 --- a/test/telemetry/compile.hxml +++ b/test/telemetry/compile.hxml @@ -2,6 +2,5 @@ -r TestMain.hx -D HXCPP_TELEMETRY -D HXCPP_STACK_TRACE --p ../unit -L utest --cpp bin \ No newline at end of file diff --git a/test/threads/compile.hxml b/test/threads/compile.hxml index 8db60c868..96e05ffae 100644 --- a/test/threads/compile.hxml +++ b/test/threads/compile.hxml @@ -1,4 +1,3 @@ --main Test --cpp cpp --debug --cp ../unit +-m Test +--cpp cpp +--debug \ No newline at end of file diff --git a/test/unit/haxe/unit/TestCase.hx b/test/unit/haxe/unit/TestCase.hx deleted file mode 100644 index b81704316..000000000 --- a/test/unit/haxe/unit/TestCase.hx +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C)2005-2017 Haxe Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -package haxe.unit; -import haxe.PosInfos; - -/** - This unit test class should be extended to create test cases. Each test - method created in this extended class should start with the name "test". - - These test methods should call the assertion methods: - - * `assertTrue(a)`: Succeeds if `a` is `true`. - * `assertFalse(a)`: Succeeds if `a` is `false`. - * `assertEquals(expected, actual)`: Succeeds if `expected` and `actual` - are equal. - - ```haxe - class MyTestCase extends haxe.unit.TestCase { - function testBasic() { - assertEquals("A", "A"); - } - } - ``` - - The TestCase can be tested using `TestRunner`. - - To run code before or after the test, override the functions `setup` - and `tearDown`. - - @see -**/ -@:keepSub -@:publicFields -class TestCase { - /** - The current test status of the TestRunner. - **/ - public var currentTest : TestStatus; - - public function new( ) { - } - - /** - Override this method to execute code before the test runs. - **/ - public function setup() : Void { - } - - /** - Override this method to execute code after the test ran. - **/ - public function tearDown() : Void { - } - - function print( v : Dynamic ) { - haxe.unit.TestRunner.print(v); - } - - /** - Succeeds if `b` is `true`. - **/ - function assertTrue( b:Bool, ?c : PosInfos ) : Void { - currentTest.done = true; - if (b != true){ - currentTest.success = false; - currentTest.error = "expected true but was false"; - currentTest.posInfos = c; - throw currentTest; - } - } - - /** - Succeeds if `b` is `false`. - **/ - function assertFalse( b:Bool, ?c : PosInfos ) : Void { - currentTest.done = true; - if (b == true){ - currentTest.success = false; - currentTest.error = "expected false but was true"; - currentTest.posInfos = c; - throw currentTest; - } - } - - /** - Succeeds if `expected` and `actual` are equal. - **/ - function assertEquals( expected: T , actual: T, ?c : PosInfos ) : Void { - currentTest.done = true; - if (actual != expected){ - currentTest.success = false; - currentTest.error = "expected '" + expected + "' but was '" + actual + "'"; - currentTest.posInfos = c; - throw currentTest; - } - } -} diff --git a/test/unit/haxe/unit/TestResult.hx b/test/unit/haxe/unit/TestResult.hx deleted file mode 100644 index f906e4243..000000000 --- a/test/unit/haxe/unit/TestResult.hx +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C)2005-2017 Haxe Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - package haxe.unit; - -/** - TestResult contains the result of the executed unit tests. -**/ -class TestResult { - var m_tests : List; - - /** - `true` if the unit test succesfully executed the test cases. - **/ - public var success(default, null) : Bool; - - public function new() { - m_tests = new List(); - success = true; - } - - public function add( t:TestStatus ) : Void { - m_tests.add(t); - if( !t.success ) - success = false; - } - - /** - String representation from the result of the unit test. - **/ - public function toString() : String { - var buf = new StringBuf(); - var failures = 0; - for ( test in m_tests ){ - if (test.success == false){ - buf.add("* "); - buf.add(test.classname); - buf.add("::"); - buf.add(test.method); - buf.add("()"); - buf.add("\n"); - - buf.add("ERR: "); - if( test.posInfos != null ){ - buf.add(test.posInfos.fileName); - buf.add(":"); - buf.add(test.posInfos.lineNumber); - buf.add("("); - buf.add(test.posInfos.className); - buf.add("."); - buf.add(test.posInfos.methodName); - buf.add(") - "); - } - buf.add(test.error); - buf.add("\n"); - - if (test.backtrace != null) { - buf.add(test.backtrace); - buf.add("\n"); - } - - buf.add("\n"); - failures++; - } - } - buf.add("\n"); - if (failures == 0) - buf.add("OK "); - else - buf.add("FAILED "); - - buf.add(m_tests.length); - buf.add(" tests, "); - buf.add(failures); - buf.add(" failed, "); - buf.add( (m_tests.length - failures) ); - buf.add(" success"); - buf.add("\n"); - return buf.toString(); - } - -} diff --git a/test/unit/haxe/unit/TestRunner.hx b/test/unit/haxe/unit/TestRunner.hx deleted file mode 100644 index 7473d780f..000000000 --- a/test/unit/haxe/unit/TestRunner.hx +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C)2005-2017 Haxe Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -package haxe.unit; -import Reflect; - -/** - This class runs unit test cases and prints the result. - - ```haxe - var r = new haxe.unit.TestRunner(); - r.add(new MyTestCase()); - // add other TestCases here - - // finally, run the tests - r.run(); - ``` - - @see -**/ -class TestRunner { - /** - The unit test results. Available after the `run()` is called. - **/ - public var result(default, null) : TestResult; - - var cases : List; - -#if flash - static var tf : flash.text.TextField = null; -#end - - /** - Prints the given object/value. - - * Flash outputs the result in a new `TextField` on stage. - * JavaScript outputs the result using `console.log`. - * Other targets use native `print` to output the result. - - This function is `dynamic` so it can be overriden in custom setups. - **/ - public static dynamic function print( v : Dynamic ) untyped { - #if flash - if( tf == null ) { - tf = new flash.text.TextField(); - tf.selectable = false; - tf.width = flash.Lib.current.stage.stageWidth; - tf.autoSize = flash.text.TextFieldAutoSize.LEFT; - flash.Lib.current.addChild(tf); - } - tf.appendText(v); - #elseif neko - __dollar__print(v); - #elseif php - php.Lib.print(v); - #elseif cpp - cpp.Lib.print(v); - #elseif js - var msg = js.Boot.__string_rec(v,""); - var d; - if( __js__("typeof")(document) != "undefined" - && (d = document.getElementById("haxe:trace")) != null ) { - msg = StringTools.htmlEscape(msg).split("\n").join("
"); - d.innerHTML += msg+"
"; - } - 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 - cs.system.Console.Write(v); - #elseif java - var str:String = v; - untyped __java__("java.lang.System.out.print(str)"); - #elseif python - python.Lib.print(v); - #elseif (hl || lua) - Sys.print(Std.string(v)); - #end - } - - private static function customTrace( v, ?p : haxe.PosInfos ) { - print(p.fileName+":"+p.lineNumber+": "+Std.string(v)+"\n"); - } - - public function new() { - result = new TestResult(); - cases = new List(); - } - - /** - Add TestCase instances to the unit test. - **/ - public function add( c:TestCase ) : Void{ - cases.add(c); - } - - /** - Runs the unit tests and prints the results. - - @return `true` if the unit test succesfully executed the test cases. - **/ - public function run() : Bool { - result = new TestResult(); - for ( c in cases ){ - runCase(c); - } - print(result.toString()); - return result.success; - } - - function runCase( t:TestCase ) : Void { - var old = haxe.Log.trace; - haxe.Log.trace = customTrace; - - var cl = Type.getClass(t); - var fields = Type.getInstanceFields(cl); - - print( "Class: "+Type.getClassName(cl)+" "); - for ( f in fields ){ - var fname = f; - var field = Reflect.field(t, f); - if ( StringTools.startsWith(fname,"test") && Reflect.isFunction(field) ){ - t.currentTest = new TestStatus(); - t.currentTest.classname = Type.getClassName(cl); - t.currentTest.method = fname; - t.setup(); - - try { - Reflect.callMethod(t, field, new Array()); - - if( t.currentTest.done ){ - t.currentTest.success = true; - print("."); - }else{ - t.currentTest.success = false; - t.currentTest.error = "(warning) no assert"; - print("W"); - } - }catch ( e : TestStatus ){ - print("F"); - t.currentTest.backtrace = haxe.CallStack.toString(haxe.CallStack.exceptionStack()); - }catch ( e : Dynamic ){ - print("E"); - #if js - if( e.message != null ){ - t.currentTest.error = "exception thrown : "+e+" ["+e.message+"]"; - }else{ - t.currentTest.error = "exception thrown : "+e; - } - #else - t.currentTest.error = "exception thrown : "+e; - #end - t.currentTest.backtrace = haxe.CallStack.toString(haxe.CallStack.exceptionStack()); - } - result.add(t.currentTest); - t.tearDown(); - } - } - - print("\n"); - haxe.Log.trace = old; - } -} diff --git a/test/unit/haxe/unit/TestStatus.hx b/test/unit/haxe/unit/TestStatus.hx deleted file mode 100644 index bd885597b..000000000 --- a/test/unit/haxe/unit/TestStatus.hx +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C)2005-2017 Haxe Foundation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -package haxe.unit; -import haxe.CallStack; - -import haxe.PosInfos; - -/** - The status information of a unit test case method. - - @see -**/ -class TestStatus { - /** - `true` when the unit test is executed. - **/ - public var done : Bool; - - /** - `true` when succesfully unit tested. - **/ - public var success : Bool; - - /** - The error message of the unit test method. - **/ - public var error : String; - - /** - The method name of the unit test. - **/ - public var method : String; - - /** - The class name of the unit test. - **/ - public var classname : String; - - /** - The position information of the unit test. - **/ - public var posInfos : PosInfos; - - /** - The representation of the stack exception. - **/ - public var backtrace : String; - - public function new() { - done = false; - success = false; - } -}