2
0
Rudy Ges 1 жил өмнө
parent
commit
436e3d886e

+ 26 - 0
tests/server/src/cases/issues/Issue11480.hx

@@ -0,0 +1,26 @@
+package cases.issues;
+
+import haxe.io.Path;
+
+class Issue11480 extends TestCase {
+	function test(_) {
+		vfs.putContent("Main.hx", "function main() {}");
+		var args = [
+			"-main",
+			"Main",
+			"-hl",
+			"bin/out.hl",
+			"-D",
+			"no-compilation"
+		];
+		runHaxe(args);
+		assertSuccess();
+
+		var std = Path.removeTrailingSlashes(utils.macro.BuildHub.getStd());
+		runHaxeJsonCb(args, DisplayMethods.Hover, {file: new FsPath('${std}/StdTypes.hx'), offset: 0}, (res) -> {
+			// If we don't use the cb version, assertSuccess() below will pass even when request fails..
+			Assert.isNull(res);
+		});
+		assertSuccess();
+	}
+}

+ 7 - 0
tests/server/src/utils/macro/BuildHub.hx

@@ -0,0 +1,7 @@
+package utils.macro;
+
+class BuildHub {
+	macro static public function build();
+	macro static public function getStd();
+}
+

+ 5 - 0
tests/server/src/utils/macro/BuildHub.macro.hx

@@ -19,6 +19,11 @@ class BuildHub {
 		return TestBuilder.build(fields);
 	}
 
+	macro static public function getStd() {
+		var std = haxe.macro.Compiler.getConfiguration().stdPath;
+		return macro $v{std.shift()};
+	}
+
 	static function isDisplayTest(cls:ClassType):Bool {
 		if(cls.pack.length == 0 && cls.name == "DisplayTestCase") {
 			return true;