Browse Source

added TestCasts

Nicolas Cannasse 7 years ago
parent
commit
3b8ba30777
2 changed files with 17 additions and 0 deletions
  1. 16 0
      tests/unit/src/unit/TestCasts.hx
  2. 1 0
      tests/unit/src/unit/TestMain.hx

+ 16 - 0
tests/unit/src/unit/TestCasts.hx

@@ -0,0 +1,16 @@
+package unit;
+
+class TestCasts extends Test  {
+
+	static function foo( f : Float ) {
+		return f;
+	}
+
+	static function make( f : Dynamic ) return f;
+
+	function testCasts() {
+		var f : Int -> Float = make(foo);
+		eq( f(123), 123);
+	}
+
+}

+ 1 - 0
tests/unit/src/unit/TestMain.hx

@@ -63,6 +63,7 @@ class TestMain {
 			new TestGADT(),
 			new TestGeneric(),
 			new TestArrowFunctions(),
+			new TestCasts(),
 			#if !no_pattern_matching
 			new TestMatch(),
 			#end