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 aa002ff5f6de9e97a1bed909b00ccc2560ee2ac5..8cabf932a615c343ed1a584186e141971a76bd1a 100644 |
--- a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java |
+++ b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java |
@@ -172,4 +172,39 @@ public class NegativeParserTest extends CompilerTestCase { |
assertEquals(true, factory.getName() instanceof DartIdentifier); |
assertEquals("foo<T>", ((DartIdentifier) factory.getName()).getTargetName()); |
} |
+ public void test_defaultParameterValue_inInterfaceMethod() { |
+ parseExpectErrors( |
+ "interface A { f(int a, [int b = 12345]); }", |
+ errEx(ParserErrorCode.DEFAULT_PARAMETER_INTERFACE, 1, 33, 5)); |
+ } |
+ |
+ public void test_defaultParameterValue_inAbstractMethod() { |
+ parseExpectErrors( |
+ "class A { abstract f(int a, [int b = 12345, int c]); }", |
+ errEx(ParserErrorCode.DEFAULT_PARAMETER_ABSTRACT, 1, 38, 5)); |
+ } |
+ |
+ public void test_defaultParameterValue_inClosureTypedef() { |
+ parseExpectErrors( |
+ "typedef void f(int a, [int b = 12345, inc c]);", |
+ errEx(ParserErrorCode.DEFAULT_PARAMETER_TYPEDEF, 1, 32, 5)); |
+ } |
+ |
+ public void test_defaultParameterValue_inClosure() { |
+ parseExpectErrors( |
+ "class A {void f(void cb(int a, [int b = 12345, int c])) {}}", |
+ errEx(ParserErrorCode.DEFAULT_PARAMETER_CLOSURE, 1, 41, 5)); |
+ } |
+ |
+ public void test_namedParameterValue_inSetter() { |
+ parseExpectErrors( |
+ "class A { set f([int b]); }", |
+ errEx(ParserErrorCode.EACH_PARAMETER_IS_REQUIRED, 1, 18, 5)); |
+ } |
+ |
+ public void test_namedParameterValue_inOperator() { |
+ parseExpectErrors( |
+ "class A { operator []=(int a, [int b]); }", |
+ errEx(ParserErrorCode.EACH_PARAMETER_IS_REQUIRED, 1, 32, 5)); |
+ } |
} |