浏览代码

[tests] add test

Rudy Ges 5 天之前
父节点
当前提交
dd0f97c0b4
共有 2 个文件被更改,包括 24 次插入0 次删除
  1. 13 0
      tests/unit/src/unit/issues/Issue12415.hx
  2. 11 0
      tests/unit/src/unit/issues/misc/Issue12415Abstract.hx

+ 13 - 0
tests/unit/src/unit/issues/Issue12415.hx

@@ -0,0 +1,13 @@
+package unit.issues;
+
+using unit.issues.misc.Issue12415Abstract;
+
+class Issue12415 extends Test {
+	function test() {
+		var value:Issue12415Abstract = null;
+		eq(#if static haxe.Int64.ofInt(0) #else null #end, value);
+		eq(true, value == null);
+		eq(false, value != null);
+		eq(true, value.isNull());
+	}
+}

+ 11 - 0
tests/unit/src/unit/issues/misc/Issue12415Abstract.hx

@@ -0,0 +1,11 @@
+package unit.issues.misc;
+
+import haxe.Int64;
+
+@:fromNull
+abstract Issue12415Abstract(Int64) from Int64 to Int64 {
+	public inline function isNull() {
+		#if !static if (this == null) return true; #end
+		return haxe.Int64.isZero(this);
+	}
+}