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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java

Issue 15797007: Report CompileTimeErrorCode for 'const' argument mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/resolver/CompileTimeErrorCodeTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index 911193dc26263ea5f9ff704a5ae31d2cbaf97ef3..a9bc09cc96a2a7362f9a7977624caa71b6177029 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -1109,6 +1109,19 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_extraPositionalArguments_const() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A();",
+ "}",
+ "main() {",
+ " const A(0);",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS);
+ verify(source);
+ }
+
public void test_fieldInitializedByMultipleInitializers() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -2292,6 +2305,19 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_notEnoughRequiredArguments_const() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A(int p);",
+ "}",
+ "main() {",
+ " const A();",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS);
+ verify(source);
+ }
+
public void test_optionalParameterInOperator_named() throws Exception {
Source source = addSource(createSource(//
"class A {",
@@ -2709,6 +2735,19 @@ public class CompileTimeErrorCodeTest extends ResolverTestCase {
verify(source);
}
+ public void test_undefinedNamedParameter() throws Exception {
+ Source source = addSource(createSource(//
+ "class A {",
+ " const A();",
+ "}",
+ "main() {",
+ " const A(p: 0);",
+ "}"));
+ resolve(source);
+ assertErrors(CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER);
+ // no verify(), 'p' is not resolved
+ }
+
public void test_uriDoesNotExist_export() throws Exception {
Source source = addSource(createSource(//
"export 'unknown.dart';"));

Powered by Google App Engine
This is Rietveld 408576698