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

Side by Side Diff: tests/language/field_initialization_order_test.dart

Issue 10908007: Add test for final field initialization (fails on the VM). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/final_field_initialization_order_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4
4 // Test that field initializers are evaluated in the right order. 5 // Test that field initializers are evaluated in the right order.
5 6
6 int counter = 0; 7 int counter = 0;
7 8
8 class Mark { 9 class Mark {
9 static StringBuffer buffer; 10 static StringBuffer buffer;
10 Mark(value) { 11 Mark(value) {
11 buffer.add('$value.'); 12 buffer.add('$value.');
12 } 13 }
13 } 14 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 56
56 main() { 57 main() {
57 Expect.equals('a.', run(() => new OneField())); 58 Expect.equals('a.', run(() => new OneField()));
58 Expect.equals('a.ai.', run(() => new OneField.init())); 59 Expect.equals('a.ai.', run(() => new OneField.init()));
59 60
60 Expect.equals('b.a.', run(() => new TwoFields())); 61 Expect.equals('b.a.', run(() => new TwoFields()));
61 Expect.equals('b.a.ai.', run(() => new TwoFields.initA())); 62 Expect.equals('b.a.ai.', run(() => new TwoFields.initA()));
62 Expect.equals('b.a.bi.', run(() => new TwoFields.initB())); 63 Expect.equals('b.a.bi.', run(() => new TwoFields.initB()));
63 Expect.equals('b.a.ai.bi.', run(() => new TwoFields.initBoth())); 64 Expect.equals('b.a.ai.bi.', run(() => new TwoFields.initBoth()));
64 65
65 Expect.equals('b.a.', run(() => new InheritOneField())); 66 Expect.equals('b.a.', run(() =>
66 Expect.equals('b.bi.a.', run(() => new InheritOneField.init())); 67 new InheritOneField()));
67 Expect.equals('b.a.ai.', run(() => new InheritOneField.superWithInit())); 68 Expect.equals('b.bi.a.', run(() =>
68 Expect.equals('b.bi.a.ai.', run(() => new InheritOneField.initWithSuperInit()) ); 69 new InheritOneField.init()));
69 Expect.equals('b.a.ai.bi.', run(() => new InheritOneField.initWithSuperInit2() )); 70 Expect.equals('b.a.ai.', run(() =>
71 new InheritOneField.superWithInit()));
72 Expect.equals('b.bi.a.ai.', run(() =>
73 new InheritOneField.initWithSuperInit()));
74 Expect.equals('b.a.ai.bi.', run(() =>
75 new InheritOneField.initWithSuperInit2()));
70 } 76 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/final_field_initialization_order_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698