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

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

Issue 9699033: Introduce FieldParameterElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and create a separate map for the fields. Created 8 years, 9 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/language/src/FieldParameterTest.dart
diff --git a/tests/language/src/FieldParameterTest.dart b/tests/language/src/FieldParameterTest.dart
new file mode 100644
index 0000000000000000000000000000000000000000..80037f591091b441fa821a9fb0b0102d164e0b54
--- /dev/null
+++ b/tests/language/src/FieldParameterTest.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program for testing setting/getting of instance fields.
+
+class A {
+ var x = 4;
+ A(this.x);
+ A.named([this.x]);
+ A.named2([this.x = 2]);
+ A.named3();
+}
+
+class B extends A {
+ B(x) : super(x + 10);
+ B.named_() : super.named();
+ B.named(x) : super.named(x + 10);
+ B.named2_() : super.named2();
+ B.named2(x) : super.named2(x + 10);
+ B.named3() : super.named3();
+}
+
+main() {
+ Expect.equals(0, new A(0).x);
+ Expect.equals(null, new A.named().x);
+ Expect.equals(1, new A.named(1).x);
+ Expect.equals(2, new A.named2().x);
+ Expect.equals(3, new A.named2(3).x);
+ Expect.equals(4, new A.named3().x);
+
+ Expect.equals(10, new B(0).x);
+ Expect.equals(null, new B.named_().x);
+ Expect.equals(11, new B.named(1).x);
+ Expect.equals(2, new B.named2_().x);
+ Expect.equals(13, new B.named2(3).x);
+ Expect.equals(4, new B.named3().x);
+}
« frog/leg/compile_time_constants.dart ('K') | « tests/language/src/CompileTimeConstantGTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698