浏览代码

[tests] add more tests for #7935

Jens Fischer 6 年之前
父节点
当前提交
80fb8c56d1

+ 2 - 1
tests/display/.vscode/launch.json

@@ -4,7 +4,8 @@
 		{
 		{
 			"name": "Interpreter",
 			"name": "Interpreter",
 			"type": "haxe-eval",
 			"type": "haxe-eval",
-			"request": "launch"
+			"request": "launch",
+			"args": ["build.hxml", "-lib", "test-adapter"]
 		}
 		}
 	]
 	]
 }
 }

+ 28 - 2
tests/display/src/cases/Issue7935.hx

@@ -8,13 +8,39 @@ class Issue7935 extends DisplayTestCase {
 			}
 			}
 		}
 		}
 	**/
 	**/
-	function test() {
+	function test1() {
+		hasParserError("Expected expression or )");
+	}
+
+	/**
+		class Main {
+			public static function main() {
+				trace(0
+			{-1-}}{-2-}
+		}
+	**/
+	function test2() {
+		hasParserError("Expected , or )");
+	}
+
+	/**
+		class Main {
+			public static function main() {
+				trace(0,
+			{-1-}}{-2-}
+		}
+	**/
+	function test3() {
+		hasParserError("Expected expression");
+	}
+
+	function hasParserError(message:String) {
 		arrayEq([
 		arrayEq([
 			{
 			{
 				kind: DKParserError,
 				kind: DKParserError,
 				range: diagnosticsRange(pos(1), pos(2)),
 				range: diagnosticsRange(pos(1), pos(2)),
 				severity: Error,
 				severity: Error,
-				args: "Expected expression or )"
+				args: message
 			}
 			}
 		], diagnostics());
 		], diagnostics());
 	}
 	}

+ 5 - 0
tests/misc/projects/Issue7935/Main2.hx

@@ -0,0 +1,5 @@
+class Main {
+	public static function main() {
+		trace(0
+	}
+}

+ 5 - 0
tests/misc/projects/Issue7935/Main3.hx

@@ -0,0 +1,5 @@
+class Main {
+	public static function main() {
+		trace(0,
+	}
+}

+ 2 - 0
tests/misc/projects/Issue7935/compile2-fail.hxml

@@ -0,0 +1,2 @@
+--main Main2
+--interp

+ 1 - 0
tests/misc/projects/Issue7935/compile2-fail.hxml.stderr

@@ -0,0 +1 @@
+Main2.hx:4: characters 2-3 : Expected , or )

+ 2 - 0
tests/misc/projects/Issue7935/compile3-fail.hxml

@@ -0,0 +1,2 @@
+--main Main3
+--interp

+ 1 - 0
tests/misc/projects/Issue7935/compile3-fail.hxml.stderr

@@ -0,0 +1 @@
+Main3.hx:4: characters 2-3 : Unexpected }