ソースを参照

[tests] add test

Rudy Ges 5 日 前
コミット
dd0f97c0b4

+ 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);
+	}
+}