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

Unified Diff: tests/language/src/ParameterInitializerTest.dart

Issue 8682025: Allow optional initializing formals again (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « tests/language/src/ParameterInitializer5NegativeTest.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/ParameterInitializerTest.dart
===================================================================
--- tests/language/src/ParameterInitializerTest.dart (revision 1815)
+++ tests/language/src/ParameterInitializerTest.dart (working copy)
@@ -5,11 +5,28 @@
class ParameterInitializerTest {
static testMain() {
- new Foo.untyped(1);
- new Foo.supertype(1);
- new Foo.subtype(1);
+ var obj = new Foo.untyped(1);
+ Expect.equals(1, obj.x);
- var obj = new Foo(1);
+ obj = new Foo.supertype(9);
+ Expect.equals(9, obj.x);
+
+ obj = new Foo.subtype(7);
+ Expect.equals(7, obj.x);
+
+ obj = new Foo.optional(x: 111);
+ Expect.equals(111, obj.x);
+
+ obj = new Foo.optional();
+ Expect.equals(5, obj.x);
+
+ obj = new Foo.optional_private(_y: 222);
+ Expect.equals(222, obj._y);
+
+ obj = new Foo.optional_private();
+ Expect.equals(77, obj._y);
+
+ obj = new Foo(1);
Expect.equals(2, obj.x);
obj = new SubFoo(42);
@@ -30,8 +47,11 @@
Foo.untyped(this.x) {}
Foo.supertype(Object this.x) {}
Foo.subtype(int this.x) {}
+ Foo.optional([this.x = 5]) {}
+ Foo.optional_private([this._y = 77]) {}
num x;
+ num _y;
}
class SubFoo extends Foo {
« no previous file with comments | « tests/language/src/ParameterInitializer5NegativeTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698