浏览代码

[tests] restore some tests

Rudy Ges 2 年之前
父节点
当前提交
93329f7e2b

+ 10 - 8
tests/unit/src/unit/issues/Issue2889.hx

@@ -1,14 +1,15 @@
 package unit.issues;
 
 class Issue2889 extends Test {
-	public function test() {
-		function mapMappable<A, B>(m:Mappable<A>, f:A->B):Mappable<B> {
+	public function test()
+	{
+		function mapMappable <A,B>(m:Mappable<A>, f:A->B):Mappable<B> {
 			return m.map(f);
 		}
-		var r = mapMappable([1], function(y) return y + 1);
+		var r = mapMappable([1], function (y) return y+1);
 		var r:Array<Int> = cast r;
-		eq(r.length, 1);
-		eq(2, r[0]);
+		eq(r.length,1);
+		eq(2,r[0]);
 	}
 
 	function testDynamic() {
@@ -23,14 +24,14 @@ class Issue2889 extends Test {
 	}
 
 	function testFilterStructure() {
-		var a:{function filter(f:Int->Bool):Array<Int>;} = [1, 2];
+		var a:{ function filter(f:Int->Bool):Array<Int>; } = [1, 2];
 		var b = a.filter(function(x) return x % 2 == 0);
 		eq(1, b.length);
 		eq(2, b[0]);
 	}
 
 	function testMapStructure() {
-		var a:{function map(f:Int->Int):Array<Int>;} = [1, 2];
+		var a:{ function map(f:Int->Int):Array<Int>; } = [1, 2];
 		var b = a.map(function(x) return x * 2);
 		eq(2, b.length);
 		eq(2, b[0]);
@@ -39,5 +40,6 @@ class Issue2889 extends Test {
 }
 
 private typedef Mappable<Y> = {
-	public function map<X>(f:Y->X):Array<X>;
+	public function map <X>(f:Y->X):Array<X>;
 }
+

+ 19 - 19
tests/unit/src/unit/issues/Issue5793.hx

@@ -1,24 +1,24 @@
 package unit.issues;
 
 class Issue5793 extends Test {
-	public function test() {
-		function run1() {
-			function foo<T>(expected:Array<T>, a:T) {
-				eq(expected[0], a);
-			}
-			foo([2], 2);
-		}
-		run1();
+  public function test() {
+    function run1() {
+      function foo <T> (expected:Array<T>, a:T) {
+        eq(expected[0], a);
+      }
+      foo([2], 2);
+    }
+    run1();
 
-		function run2() {
-			function bar<A>(expected:Array<A>, a:A) {
-				function baz<B>(expected:Array<B>, b:B) {
-					eq(expected[0], b);
-				}
-				baz(expected, a);
-			}
-			bar([42], 42);
-		}
-		run2();
-	}
+    function run2() {
+      function bar<A>(expected:Array<A>, a:A) {
+        function baz<B>(expected:Array<B>, b:B) {
+          eq(expected[0], b);
+        }
+        baz(expected,a);
+      }
+      bar([42],42);
+    }
+    run2();
+  }
 }

+ 2 - 3
tests/unit/src/unit/issues/Issue6106.hx

@@ -4,12 +4,11 @@ class Issue6106 extends unit.Test {
 	function test() {
 		var code = 0;
 		function assertEquals<T>(expected:T, actual:T) {
-			if (expected != actual)
-				code++;
+			if(expected != actual) code++;
 		}
 
 		var f = function() assertEquals(1, 1);
 		f();
 		noAssert();
 	}
-}
+}

+ 3 - 3
tests/unit/src/unit/issues/Issue6304.hx

@@ -5,9 +5,9 @@ class Issue6304 extends unit.Test {
 		eq(2, main1([], 1));
 	}
 
-	static function main1(arr:Array<{}>, multiplier:Int) {
-		function doSomething<T>() {
-			var mul:Int = multiplier;
+	static function main1 (arr:Array<{}>, multiplier:Int) {
+		function doSomething <T>() {
+			var mul:Int =  multiplier;
 			arr.push({});
 			return arr.length + mul;
 		};

+ 11 - 10
tests/unit/src/unit/issues/Issue6560.hx

@@ -1,13 +1,14 @@
 package unit.issues;
 
 class Issue6560 extends unit.Test {
-	function test() {
-		function foo<F>(a:F):Array<F> {
-			if (false)
-				foo(1);
-			return if (a == null) [] else foo(null);
-		}
-		var bar:Array<Int> = foo(1);
-		eq(0, bar.length);
-	}
-}
+
+    function test() {
+        function foo<F>(a:F):Array<F> {
+            if (false) foo(1);
+            return if (a == null) [] else foo(null);
+        }
+        var bar:Array<Int> = foo(1);
+        eq(0, bar.length);
+    }
+
+}

+ 3 - 7
tests/unit/src/unit/issues/Issue6751.hx

@@ -3,19 +3,15 @@ package unit.issues;
 import unit.HelperMacros.typedAs;
 
 private abstract O(String) {
-	public function new(s)
-		this = s;
-
-	@:to function toInt()
-		return 42;
+	public function new(s) this = s;
+	@:to function toInt() return 42;
 }
 
 private abstract A<T>(T) from T {}
 
 class Issue6751 extends Test {
 	function test() {
-		function make<T>(o:A<T>)
-			return o;
+		function make<T>(o:A<T>) return o;
 
 		var o = new O("hello");
 		var a = make(o);

+ 1 - 1
tests/unit/src/unit/issues/Issue9603.hx

@@ -14,4 +14,4 @@ class Issue9603 extends Test {
 		sort(new C());
 		utest.Assert.pass();
 	}
-}
+}

+ 1 - 1
tests/unit/src/unit/issues/Issue9777.hx

@@ -8,4 +8,4 @@ class Issue9777 extends unit.Test {
 	function test() {
 		t(g());
 	}
-}
+}