浏览代码

add tests for some Null<BasicType> behaviour (#7755)

* add tests for some Null<BasicType> behaviour

* make Null<T> actually test something
Dan Korostelev 6 年之前
父节点
当前提交
11ad641b08
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 1 0
      tests/unit/src/unit/TestMain.hx
  2. 10 0
      tests/unit/src/unit/TestNull.hx

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

@@ -78,6 +78,7 @@ class TestMain {
 			new TestArrowFunctions(),
 			new TestCasts(),
 			new TestSyntaxModule(),
+			new TestNull(),
 			#if !no_pattern_matching
 			new TestMatch(),
 			#end

+ 10 - 0
tests/unit/src/unit/TestNull.hx

@@ -0,0 +1,10 @@
+package unit;
+
+class TestNull extends Test {
+	var ni:Null<Int> = null; // a field to prevent local optimizations
+
+	function test() {
+		f(ni == 0);
+		f(0 == ni);
+	}
+}