Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvrubezhny2013-12-27 14:53:05 +0000
committervrubezhny2013-12-27 14:53:05 +0000
commitefcae62e269b3c07e118bb5e6f3dd2f885676fdd (patch)
tree82d4185a834dd61c4fd8076c981d4e291779e886
parent253e2c140ebff05b824b12c79bf8f8f7853a2a71 (diff)
downloadwebtools.maps-efcae62e269b3c07e118bb5e6f3dd2f885676fdd.tar.gz
webtools.maps-efcae62e269b3c07e118bb5e6f3dd2f885676fdd.tar.xz
webtools.maps-efcae62e269b3c07e118bb5e6f3dd2f885676fdd.zip
[340756] [validation] False syntax error in with (x) var y;
JUnit test cases are added for the issue. JUnit test cases StatementRecoveryTest.test0011 and StatementRecoveryTest.test0013 are updated due regarding the new parser gramma. Signed-off-by: vrubezhny <vrubezhny@exadel.com>
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java62
2 files changed, 65 insertions, 24 deletions
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java
index d1b118a71..2a299bf98 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -972,18 +972,12 @@ public void test0011() {
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
"function X() {\n" +
- " function foo() {\n" +
- " if (true)\n" +
- " {\n" +
- " foo();\n" +
- " }\n" +
- " for (; ; ) \n" +
- " ;\n" +
- " if (true)\n" +
- " {\n" +
- " foo();\n" +
- " }\n" +
- " }\n" +
+ "}\n" +
+ "function foo() {\n" +
+ " if (true)\n" +
+ " {\n" +
+ " foo();\n" +
+ " }\n" +
"}\n";
String expectedFullUnitToString =
@@ -1082,10 +1076,9 @@ public void test0013() {
String expectedDietPlusBodyWithStatementRecoveryUnitToString =
"function X() {\n" +
- " function foo() {\n" +
- " for (var i in $missing$) \n" +
- " ;\n" +
- " }\n" +
+ "}\n" +
+ "function foo() {\n" +
+ " var i;\n" +
"}\n";
String expectedFullUnitToString =
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java
index ae47df540..fd723a9e5 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java
@@ -488,6 +488,7 @@ public class BasicParserTests extends AbstractRegressionTest {
"\n"
);
}
+
public void test009a() { // for
this.runParseTest(
"for (;i<3;i++)\n" +
@@ -498,6 +499,16 @@ public class BasicParserTests extends AbstractRegressionTest {
"\n"
);
}
+
+ public void test009b() { // for
+ this.runParseTest(
+ "for (i=1;i<3;i++) var y\n" +
+ "\n",
+ "X.js",
+ "for (i = 1; (i < 3); i ++) \n var y;"+
+ "\n"
+ );
+ }
public void test010() { // for in
this.runParseTest(
@@ -509,9 +520,29 @@ public class BasicParserTests extends AbstractRegressionTest {
"\n"
);
}
+
+ public void test010a() { // for in
+ this.runParseTest(
+ "for (a in this.vars)\n" +
+ " f++;" +
+ "\n",
+ "X.js",
+ "for (a in this.vars) \n f ++;"+
+ "\n"
+ );
+ }
-
- public void test011() { // for in
+ public void test010b() { // for in
+ this.runParseTest(
+ "for (var a in this.vars) var y\n" +
+ "\n",
+ "X.js",
+ "for (var a in this.vars) \n var y;"+
+ "\n"
+ );
+ }
+
+ public void test011() { // with
this.runParseTest(
"with (foo)\n" +
" bar;" +
@@ -522,17 +553,32 @@ public class BasicParserTests extends AbstractRegressionTest {
);
}
- public void test010a() { // for in
+ public void test011a() { // with
this.runParseTest(
- "for (a in this.vars)\n" +
- " f++;" +
+ "with (foo) var bar\n",
+ "X.js",
+ "with (foo)\n" +
+ " var bar;\n"
+ );
+ }
+
+ public void test012() { // while
+ this.runParseTest(
+ "while (foo)\n" +
+ " bar;" +
"\n",
"X.js",
- "for (a in this.vars) \n f ++;"+
- "\n"
+ "while (foo) bar;\n"
);
}
+ public void test012a() { // while
+ this.runParseTest(
+ "while (foo) var bar\n",
+ "X.js",
+ "while (foo) var bar;\n"
+ );
+ }
public void test015() { // missing semicolon
this.runParseTest(
@@ -546,6 +592,8 @@ public class BasicParserTests extends AbstractRegressionTest {
);
}
+
+
public void test015a() { // missing semicolon
this.runParseTest(
"function bar() {\n"+

Back to the top