瀏覽代碼

added optional argument tests for closures

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

+ 5 - 0
tests/unit/TestMisc.hx

@@ -234,6 +234,11 @@ class TestMisc extends Test {
 		// don't compile because we restrict nullability of function param or return type
 		// var opt4c : ?Null<Int> -> Null<Int> = opt4;
 		// var opt4c : ?Int -> Int = opt4;
+		
+		var opt5 = function(a:Int, ?b = 2) return a + b;
+		eq(3, opt5(1));
+		eq(3, opt5(1, 2));
+		eq(3, opt5(1, null));
 	}
 
 	function testIncr() {