RblSb 5 月之前
父節點
當前提交
76cf5d515b
共有 2 個文件被更改,包括 49 次插入0 次删除
  1. 30 0
      tests/server/src/cases/issues/Issue12224.hx
  2. 19 0
      tests/server/test/templates/issues/Issue12224/Main.hx

+ 30 - 0
tests/server/src/cases/issues/Issue12224.hx

@@ -0,0 +1,30 @@
+package cases.issues;
+
+import utest.Assert;
+
+class Issue12224 extends TestCase {
+	function test(_) {
+		vfs.putContent("Main.hx", getTemplate("issues/Issue12224/Main.hx"));
+		var args = [
+			"-main",
+			"Main",
+			"--js",
+			"test.js",
+			"-D",
+			"analyzer-optimize",
+			"--cmd",
+			"node test.js"
+		];
+
+		runHaxe(args);
+		assertSuccess();
+		var initialContents = vfs.getContent("test.js");
+
+		runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
+
+		runHaxe(args);
+		assertSuccess();
+		var contents = vfs.getContent("test.js");
+		Assert.equals(initialContents, contents);
+	}
+}

+ 19 - 0
tests/server/test/templates/issues/Issue12224/Main.hx

@@ -0,0 +1,19 @@
+function main() {
+	var arr = [1];
+	arr.remove(1);
+	log(arr);
+	if (arr.length > 0)
+		throw "no remove";
+
+	final ints:Array<Int> = [];
+	ints.push(0);
+	for (value in ints) {
+		log(value);
+		ints.remove(value);
+	}
+	if (ints.length > 0)
+		throw "no remove";
+}
+
+@:pure(false)
+function log(v:Any):Void {}