Parcourir la source

[tests] add test for #7931

Rudy Ges il y a 1 an
Parent
commit
d62489bc51

+ 13 - 0
tests/server/src/cases/issues/Issue7931.hx

@@ -0,0 +1,13 @@
+package cases.issues;
+
+class Issue7931 extends TestCase {
+	function test(_) {
+		vfs.putContent("Main.hx", getTemplate("issues/Issue7931/Main.hx"));
+		var args = ["-main", "Main"];
+		runHaxe(args);
+		assertErrorMessage("Local variable s used without being initialized");
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Main.hx")}, res -> {
+			Assert.equals("Local variable s used without being initialized", res[0].diagnostics[0].args);
+		});
+	}
+}

+ 6 - 0
tests/server/test/templates/issues/Issue7931/Main.hx

@@ -0,0 +1,6 @@
+class Main {
+	static function main() {
+		var s:String;
+		s += "test";
+	}
+}