Selaa lähdekoodia

added optional argument tests for closures

Simon Krajewski 13 vuotta sitten
vanhempi
commit
8a19e89a4b
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  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() {