Procházet zdrojové kódy

use inline template instead of a separate file for #9087 test

Aleksandr Kuzmenko před 5 roky
rodič
revize
693f252161

+ 3 - 1
tests/server/build.hxml

@@ -5,4 +5,6 @@
 -lib hxnodejs
 -lib utest
 -lib haxeserver
--D analyzer-optimize
+-D analyzer-optimize
+# -D UTEST_PATTERN=9087
+# or set UTEST_PATTERN environment variable

+ 0 - 2
tests/server/run.hxml

@@ -1,5 +1,3 @@
 build.hxml
-# -D UTEST_PATTERN=9449
-#or set UTEST_PATTERN environment variable
 --next
 -cmd node test.js

+ 6 - 2
tests/server/src/TestCase.hx

@@ -123,12 +123,16 @@ class TestCase implements ITest {
 		return Json.parse(lastResult.stderr).result;
 	}
 
-	function parseGotoDefinition():GotoTypeDefinitionResult {
+	function parseGotoTypeDefinition():GotoTypeDefinitionResult {
 		return Json.parse(lastResult.stderr).result;
 	}
 
+	function parseGotoDefintion():GotoDefinitionResult {
+		return haxe.Json.parse(lastResult.stderr).result;
+	}
+
 	function parseGotoDefinitionLocations():Array<Location> {
-		switch parseGotoDefinition().result {
+		switch parseGotoTypeDefinition().result {
 			case null:
 				throw new Exception('No result for GotoDefinition found');
 			case result:

+ 1 - 1
tests/server/src/cases/display/issues/Issue8805.hx

@@ -5,7 +5,7 @@ class Issue8805 extends DisplayTestCase {
 		vfs.putContent("Main.hx", getTemplate("issues/Issue8805/Main.hx"));
 		var args = ["-main", "Main"];
 		runHaxeJson(args, DisplayMethods.GotoDefinition, {file: file, offset: 56});
-		var result = parseGotoDefinition();
+		var result = parseGotoTypeDefinition();
 		if (result.result.length == 0) {
 			Assert.fail('display/definition failed');
 		} else {

+ 17 - 9
tests/server/src/cases/display/issues/Issue9087.hx

@@ -1,17 +1,25 @@
 package cases.display.issues;
 
 class Issue9087 extends DisplayTestCase {
-	function test(_) {
-		var content = getTemplate("issues/Issue9087/A.hx");
-		var markers = Markers.parse(content);
-		vfs.putContent("A.hx", markers.source);
-		var args = ["A", "-js", "main.js"];
-		function parseGotoDefintion():GotoDefinitionResult {
-			return haxe.Json.parse(lastResult.stderr).result;
+	/**
+		class A {
+			public function new() {
+				in{-1-}it(); // "go to implementation" from the call site currently yields nothing
+			}
+
+			function init() {}
 		}
-		runHaxeJson(args, DisplayMethods.GotoImplementation, {file: new FsPath("A.hx"), offset: markers.offset(1), contents: markers.source});
+
+		class B extends A {
+			override function {-2-}init{-3-}() {
+				super.init();
+			}
+		}
+	**/
+	function test(_) {
+		runHaxeJson([], DisplayMethods.GotoImplementation, {file: file, offset: offset(1), contents: source});
 		var result = parseGotoDefintion().result;
 		Assert.equals(1, result.length);
-		Assert.same(markers.range(2, 3), result[0].range);
+		Assert.same(range(2, 3), result[0].range);
 	}
 }

+ 0 - 13
tests/server/test/templates/issues/Issue9087/A.hx

@@ -1,13 +0,0 @@
-class A {
-	public function new() {
-		in{-1-}it(); // "go to implementation" from the call site currently yields nothing
-	}
-
-	function init() {}
-}
-
-class B extends A {
-	override function {-2-}init{-3-}() {
-		super.init();
-	}
-}