diff options
author | vrubezhny | 2013-12-27 14:53:05 +0000 |
---|---|---|
committer | vrubezhny | 2013-12-27 14:53:05 +0000 |
commit | efcae62e269b3c07e118bb5e6f3dd2f885676fdd (patch) | |
tree | 82d4185a834dd61c4fd8076c981d4e291779e886 | |
parent | 253e2c140ebff05b824b12c79bf8f8f7853a2a71 (diff) | |
download | webtools.jsdt.tests-master.tar.gz webtools.jsdt.tests-master.tar.xz webtools.jsdt.tests-master.zip |
[340756] [validation] False syntax error in with (x) var y;HEADv201312271525master
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>
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 d1b118a..2a299bf 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 ae47df5..fd723a9 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"+ |