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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java

Issue 11314019: Using 'interface' and 'abstract' for methods should produce error (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
index b1b18c4c5e35f11b2347e1d1c95d139d6662bcce..6f7a944982692fa622769f04862b18fa14f22b74 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
@@ -25,6 +25,15 @@ public class NegativeParserTest extends CompilerTestCase {
parseExpectErrors("get foo() {}", errEx(ParserErrorCode.DEPRECATED_GETTER, 1, 5, 3));
}
+ public void test_deprecatedAbstract() {
+ parseExpectErrors(makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "abstract class A {",
+ " abstract m();",
+ "}",
+ ""), errEx(ParserErrorCode.DEPRECATED_ABSTRACT_METHOD, 3, 3, 8));
+ }
+
public void testFieldInitializerInRedirectionConstructor1() {
parseExpectErrors(
"class A { A(x) { } A.foo() : this(5), y = 5; var y; }",
@@ -356,6 +365,7 @@ public class NegativeParserTest extends CompilerTestCase {
public void testDeprecatedFactoryInInterface() {
parseExpectWarnings(
"interface foo factory bar {}",
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 1, 1, 9),
errEx(ParserErrorCode.DEPRECATED_USE_OF_FACTORY_KEYWORD, 1, 15, 7));
}
@@ -385,8 +395,18 @@ public class NegativeParserTest extends CompilerTestCase {
"// filler filler filler filler filler filler filler filler filler filler",
"abstract interface A {",
"}"),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 10, 9),
errEx(ParserErrorCode.ABSTRACT_TOP_LEVEL_ELEMENT, 2, 1, 8));
}
+
+ public void test_deprecatedInterface() {
+ parseExpectErrors(
+ Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "interface A {",
+ "}"),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 1, 9));
+ }
public void test_abstractTopLevel_typedef() {
parseExpectErrors(
@@ -400,17 +420,6 @@ public class NegativeParserTest extends CompilerTestCase {
errEx(ParserErrorCode.ABSTRACT_TOP_LEVEL_ELEMENT, 1, 1, 8));
}
- public void test_abstractMethodWithBody() {
- parseExpectErrors(
- Joiner.on("\n").join(
- "// filler filler filler filler filler filler filler filler filler filler",
- "class A {",
- " abstract foo() {",
- " }",
- "}"),
- errEx(ParserErrorCode.ABSTRACT_METHOD_WITH_BODY, 3, 12, 3));
- }
-
public void test_incompleteExpressionInInterpolation() {
parseExpectErrors(
"var s = 'fib(3) = ${fib(3}';",
@@ -425,6 +434,7 @@ public class NegativeParserTest extends CompilerTestCase {
" foo() {",
" }",
"}"),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 1, 9),
errEx(ParserErrorCode.INTERFACE_METHOD_WITH_BODY, 3, 3, 3));
}
@@ -754,6 +764,7 @@ public class NegativeParserTest extends CompilerTestCase {
"interface A native 'N' {",
"}",
""),
+ errEx(ParserErrorCode.DEPRECATED_INTERFACE, 2, 1, 9),
errEx(ParserErrorCode.NATIVE_ONLY_CLASS, 2, 13, 6));
}

Powered by Google App Engine
This is Rietveld 408576698