瀏覽代碼

add test (closes #4050)

Simon Krajewski 10 年之前
父節點
當前提交
54ba194d17
共有 1 個文件被更改,包括 27 次插入0 次删除
  1. 27 0
      tests/unit/src/unit/issues/Issue4050.hx

+ 27 - 0
tests/unit/src/unit/issues/Issue4050.hx

@@ -0,0 +1,27 @@
+package unit.issues;
+
+private interface IObject {}
+
+private class Object implements IObject {
+   public function new() {}
+}
+
+class Issue4050 extends Test {
+	function test() {
+		// Test 1: simple trace of an empty map
+		var tmp = new Map<Int, String>();
+		f(tmp.toString() == "null");
+		f(tmp == null);
+
+		// Test 2: ObjectMap with Interface as keytype and keys()-loop with value access
+		var myObject = new Object();
+		var tmp2 = new Map<IObject, Array<String>>();
+
+		tmp2.set(myObject, ["foo", "bar"]);
+		for (k in tmp2.keys()) {
+			var value = tmp2.get(k);
+			f(value.toString() == "null");
+			f(value == null);
+		}
+	}
+}