Browse Source

[tests] Add server test for #7851 (#11949)

Rudy Ges 7 months ago
parent
commit
c3695344be

+ 21 - 0
tests/server/src/cases/issues/Issue7851.hx

@@ -0,0 +1,21 @@
+package cases.issues;
+
+import utest.Assert;
+
+class Issue7851 extends TestCase {
+	function test(_) {
+		vfs.putContent("a.js", getTemplate("issues/Issue7851/a.js"));
+		vfs.putContent("Main.hx", getTemplate("issues/Issue7851/Main.hx"));
+		var args = ["-main", "Main", "--js", "test.js"];
+
+		runHaxe(args);
+		assertSuccess();
+		var initialContents = vfs.getContent("test.js");
+		Assert.isTrue(initialContents.contains("this is a.js"));
+
+		runHaxe(args);
+		assertSuccess();
+		var contents = vfs.getContent("test.js");
+		Assert.equals(initialContents, contents);
+	}
+}

+ 4 - 0
tests/server/test/templates/issues/Issue7851/Main.hx

@@ -0,0 +1,4 @@
+class Main {
+	static function __init__() haxe.macro.Compiler.includeFile("a.js");
+	static function main() {}
+}

+ 1 - 0
tests/server/test/templates/issues/Issue7851/a.js

@@ -0,0 +1 @@
+// this is a.js