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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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 // Dart test for testing super field access. 4 // Dart test for testing super field access.
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8
9 class A { 8 class A {
10 A() { 9 A() {
11 city = "Bern"; 10 city = "Bern";
12 } 11 }
13 String greeting() { 12 String greeting() {
14 return "Gruezi"; 13 return "Gruezi";
15 } 14 }
15
16 String city; 16 String city;
17 } 17 }
18 18
19
20 class B extends A { 19 class B extends A {
21 B() : super() {} 20 B() : super() {}
22 String greeting() { 21 String greeting() {
23 return "Hola " + super.greeting(); 22 return "Hola " + super.greeting();
24 } 23 }
25 } 24 }
26 25
27
28 class C extends B { 26 class C extends B {
29 C() : super() {} 27 C() : super() {}
30 String greeting() { 28 String greeting() {
31 return "Servus " + super.greeting(); 29 return "Servus " + super.greeting();
32 } 30 }
31
33 String get city { 32 String get city {
34 return "Basel " + super.city; 33 return "Basel " + super.city;
35 } 34 }
36 } 35 }
37 36
38
39 class SuperFieldTest { 37 class SuperFieldTest {
40 static testMain() { 38 static testMain() {
41 A a = new A(); 39 A a = new A();
42 B b = new B(); 40 B b = new B();
43 C c = new C(); 41 C c = new C();
44 Expect.equals("Gruezi", a.greeting()); 42 Expect.equals("Gruezi", a.greeting());
45 Expect.equals("Hola Gruezi", b.greeting()); 43 Expect.equals("Hola Gruezi", b.greeting());
46 Expect.equals("Servus Hola Gruezi", c.greeting()); 44 Expect.equals("Servus Hola Gruezi", c.greeting());
47 45
48 Expect.equals("Bern", a.city); 46 Expect.equals("Bern", a.city);
49 Expect.equals("Bern", b.city); 47 Expect.equals("Bern", b.city);
50 Expect.equals("Basel Bern", c.city); 48 Expect.equals("Basel Bern", c.city);
51 c.city = "Zurich"; 49 c.city = "Zurich";
52 Expect.equals("Basel Zurich", c.city); 50 Expect.equals("Basel Zurich", c.city);
53 } 51 }
54 } 52 }
55 53
56 main() { 54 main() {
57 SuperFieldTest.testMain(); 55 SuperFieldTest.testMain();
58 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698