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

Side by Side Diff: tests/language/src/DefaultInitTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 // Tests static and instance fields initialization.
6 class DefaultInitTest {
7 static testMain() {
8 Expect.equals(0, A.a);
9 Expect.equals(2, A.b);
10 Expect.equals(null, A.c);
11
12 A a1 = new A(42);
13 Expect.equals(42, a1.d);
14 Expect.equals(null, a1.e);
15
16 A a2 = new A.named(43);
17 Expect.equals(null, a2.d);
18 Expect.equals(43, a2.e);
19
20 Expect.equals(42, B.instance.x);
21 Expect.equals(3, C.instance.z);
22 }
23 }
24
25 class A {
26 static final int a = 0;
27 static final int b = 2;
28 static int c;
29 int d;
30 int e;
31
32 A(int val) {
33 d = val;
34 }
35
36 A.named(int val) {
37 e = val;
38 }
39 }
40
41 // The following tests cover cases described in b/4101270
42
43 class B {
44 static final B instance = const B();
45 // by putting this field after the static initializer above, the JS code gen
46 // was calling the constructor before the setter of this property was defined.
47 final int x;
48 const B() : this.x = (41 + 1);
49 }
50
51 class C {
52 // forward reference to another class
53 static final D instance = const D();
54 C() {}
55 }
56
57 class D {
58 const D(): this.z = 3;
59 final int z;
60 }
61
62 main() {
63 DefaultInitTest.testMain();
64 }
OLDNEW
« no previous file with comments | « tests/language/src/DefaultImplementationTest.dart ('k') | tests/language/src/DefaultInterface1NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698