Browse Source

[tests] be more specific for 7931 test

Rudy Ges 1 year ago
parent
commit
3fc4bda375

+ 5 - 1
tests/server/src/cases/issues/Issue7931.hx

@@ -2,12 +2,16 @@ package cases.issues;
 
 class Issue7931 extends TestCase {
 	function test(_) {
-		vfs.putContent("Main.hx", getTemplate("issues/Issue7931/Main.hx"));
+		var content = getTemplate("issues/Issue7931/Main.hx");
+		var transform = Markers.parse(content);
+
+		vfs.putContent("Main.hx", transform.source);
 		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);
+			Assert.same(transform.range(1,2), res[0].diagnostics[0].range);
 		});
 	}
 }

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

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