2
0
RblSb 5 сар өмнө
parent
commit
76cf5d515b

+ 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 {}