Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java

Issue 15269005: Report ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY and other body-related errors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java
index 5c8b83fc35847d183a4ac346f8e10e81506ced96..ba3506fab04fe656627ea09f4e30789e1e294416 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/ErrorParserTest.java
@@ -241,6 +241,14 @@ public class ErrorParserTest extends ParserTestCase {
parseCompilationUnit("const class C {}", ParserErrorCode.CONST_CLASS);
}
+ public void test_constConstructorWithBody() throws Exception {
+ parse(
+ "parseClassMember",
+ new Object[] {"C"},
+ "const C() {}",
+ ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY);
+ }
+
public void test_constFactory() throws Exception {
parse(
"parseClassMember",
@@ -579,6 +587,14 @@ public class ErrorParserTest extends ParserTestCase {
parseCompilationUnit("factory typedef F();", ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION);
}
+ public void test_factoryWithoutBody() throws Exception {
+ parse(
+ "parseClassMember",
+ new Object[] {"C"},
+ "factory C();",
+ ParserErrorCode.FACTORY_WITHOUT_BODY);
+ }
+
public void test_fieldInitializerOutsideConstructor() throws Exception {
parse(
"parseClassMember",
@@ -764,7 +780,7 @@ public class ErrorParserTest extends ParserTestCase {
public void test_missingFunctionBody_emptyNotAllowed() throws Exception {
parse(
"parseFunctionBody",
- new Object[] {false, false},
+ new Object[] {false, ParserErrorCode.MISSING_FUNCTION_BODY, false},
";",
ParserErrorCode.MISSING_FUNCTION_BODY);
}
@@ -772,7 +788,7 @@ public class ErrorParserTest extends ParserTestCase {
public void test_missingFunctionBody_invalid() throws Exception {
parse(
"parseFunctionBody",
- new Object[] {false, false},
+ new Object[] {false, ParserErrorCode.MISSING_FUNCTION_BODY, false},
"return 0;",
ParserErrorCode.MISSING_FUNCTION_BODY);
}
@@ -998,6 +1014,14 @@ public class ErrorParserTest extends ParserTestCase {
ParserErrorCode.STATIC_CONSTRUCTOR);
}
+ public void test_staticGetterWithoutBody() throws Exception {
+ parse(
+ "parseClassMember",
+ new Object[] {"C"},
+ "static get m;",
+ ParserErrorCode.STATIC_GETTER_WITHOUT_BODY);
+ }
+
public void test_staticOperator_noReturnType() throws Exception {
parse(
"parseClassMember",
@@ -1014,6 +1038,14 @@ public class ErrorParserTest extends ParserTestCase {
ParserErrorCode.STATIC_OPERATOR);
}
+ public void test_staticSetterWithoutBody() throws Exception {
+ parse(
+ "parseClassMember",
+ new Object[] {"C"},
+ "static set m(x);",
+ ParserErrorCode.STATIC_SETTER_WITHOUT_BODY);
+ }
+
public void test_staticTopLevelDeclaration_class() throws Exception {
parseCompilationUnit("static class C {}", ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION);
}

Powered by Google App Engine
This is Rietveld 408576698