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

Unified Diff: tests/compiler/dart2js/resolver_test.dart

Issue 11194025: Second round of cleanups for new optional parameter semantics. (Closed) Base URL: http://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: tests/compiler/dart2js/resolver_test.dart
===================================================================
--- tests/compiler/dart2js/resolver_test.dart (revision 13712)
+++ tests/compiler/dart2js/resolver_test.dart (working copy)
@@ -555,10 +555,10 @@
resolveConstructor(String script, String statement, String className,
String constructor, int expectedElementCount,
- [List expectedWarnings = const [],
- List expectedErrors = const [],
- String corelib = DEFAULT_CORELIB]) {
- MockCompiler compiler = new MockCompiler(corelib);
+ {List expectedWarnings: const [],
+ List expectedErrors: const [],
+ String corelib: DEFAULT_CORELIB}) {
+ MockCompiler compiler = new MockCompiler(coreSource: corelib);
compiler.parseScript(script);
compiler.resolveStatement(statement);
ClassElement classElement =
@@ -630,21 +630,24 @@
A() : a.foo = 1;
}""";
resolveConstructor(script, "A a = new A();", "A", "A", 0,
- [], [MessageKind.INVALID_RECEIVER_IN_INITIALIZER]);
+ expectedWarnings: [],
+ expectedErrors:
+ [MessageKind.INVALID_RECEIVER_IN_INITIALIZER]);
script = """class A {
int foo;
A() : this.foo = 1, this.foo = 2;
}""";
resolveConstructor(script, "A a = new A();", "A", "A", 2,
- [MessageKind.ALREADY_INITIALIZED],
- [MessageKind.DUPLICATE_INITIALIZER]);
+ expectedWarnings: [MessageKind.ALREADY_INITIALIZED],
+ expectedErrors: [MessageKind.DUPLICATE_INITIALIZER]);
script = """class A {
A() : this.foo = 1;
}""";
resolveConstructor(script, "A a = new A();", "A", "A", 0,
- [], [MessageKind.CANNOT_RESOLVE]);
+ expectedWarnings: [],
+ expectedErrors: [MessageKind.CANNOT_RESOLVE]);
script = """class A {
int foo;
@@ -652,22 +655,23 @@
A() : this.foo = bar;
}""";
resolveConstructor(script, "A a = new A();", "A", "A", 3,
- [], [MessageKind.NO_INSTANCE_AVAILABLE]);
+ expectedWarnings: [],
+ expectedErrors: [MessageKind.NO_INSTANCE_AVAILABLE]);
script = """class A {
int foo() => 42;
A() : foo();
}""";
resolveConstructor(script, "A a = new A();", "A", "A", 0,
- [], [MessageKind.CONSTRUCTOR_CALL_EXPECTED]);
+ expectedWarnings: [],
+ expectedErrors: [MessageKind.CONSTRUCTOR_CALL_EXPECTED]);
script = """class A {
int i;
A.a() : this.b(0);
A.b(int i);
}""";
- resolveConstructor(script, "A a = new A.a();", "A", "a", 1,
- [], []);
+ resolveConstructor(script, "A a = new A.a();", "A", "a", 1);
script = """class A {
int i;
@@ -675,7 +679,9 @@
A(int i);
}""";
resolveConstructor(script, "A a = new A.a();", "A", "a", 2,
- [], [MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER]);
+ expectedWarnings: [],
+ expectedErrors:
+ [MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER]);
script = """class A {
int i;
@@ -684,8 +690,7 @@
class B extends A {
B() : super(0);
}""";
- resolveConstructor(script, "B a = new B();", "B", "B", 1,
- [], []);
+ resolveConstructor(script, "B a = new B();", "B", "B", 1);
script = """class A {
int i;
@@ -695,7 +700,8 @@
B() : super(0), super(1);
}""";
resolveConstructor(script, "B b = new B();", "B", "B", 2,
- [], [MessageKind.DUPLICATE_SUPER_INITIALIZER]);
+ expectedWarnings: [],
+ expectedErrors: [MessageKind.DUPLICATE_SUPER_INITIALIZER]);
script = "";
final String CORELIB_WITH_INVALID_OBJECT =
@@ -712,7 +718,8 @@
class Dynamic_ {}
class Object { Object() : super(); }''';
resolveConstructor(script, "Object o = new Object();", "Object", "Object", 1,
- [], [MessageKind.SUPER_INITIALIZER_IN_OBJECT],
+ expectedWarnings: [],
+ expectedErrors: [MessageKind.SUPER_INITIALIZER_IN_OBJECT],
corelib: CORELIB_WITH_INVALID_OBJECT);
}

Powered by Google App Engine
This is Rietveld 408576698