瀏覽代碼

added failing callback unit test

Simon Krajewski 13 年之前
父節點
當前提交
474473070b
共有 2 個文件被更改,包括 6 次插入0 次删除
  1. 1 0
      tests/unit/MyClass.hx
  2. 5 0
      tests/unit/TestType.hx

+ 1 - 0
tests/unit/MyClass.hx

@@ -101,6 +101,7 @@ class InitBase {
 	public var b = true;
 	public var b = true;
 	public var a = [true, false];
 	public var a = [true, false];
 	public var complex = { var i = 10; for (v in 0...15) i++; i; };
 	public var complex = { var i = 10; for (v in 0...15) i++; i; };
+	public var newInit = new MyClass(12);
 	public function new() { }
 	public function new() { }
 }
 }
 
 

+ 5 - 0
tests/unit/TestType.hx

@@ -267,6 +267,10 @@ class TestType extends Test {
 		var foo = function ( x : Int, ?p : haxe.PosInfos ) { return "foo" + x; }
 		var foo = function ( x : Int, ?p : haxe.PosInfos ) { return "foo" + x; }
 		var f : Void -> String = callback(foo, 0);
 		var f : Void -> String = callback(foo, 0);
  		eq("foo0", f());
  		eq("foo0", f());
+
+		var foo = function(bar = 2) { return bar; };
+		var l = callback(foo, _);
+		eq(2, l());	
 	}
 	}
 	
 	
 	function testConstantAnonCovariance()
 	function testConstantAnonCovariance()
@@ -348,6 +352,7 @@ class TestType extends Test {
 		t(c.a[0]);
 		t(c.a[0]);
 		f(c.a[1]);
 		f(c.a[1]);
 		eq(c.complex, 25);
 		eq(c.complex, 25);
+		eq(c.newInit.get(), 12);
 		
 		
 		var c = new InitChild();
 		var c = new InitChild();
 		eq(c.i, 2);
 		eq(c.i, 2);