| OLD | NEW |
| 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 // Third dart test program. | 4 // Third dart test program. |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 | 7 |
| 8 class A extends B { | 8 class A extends B { |
| 9 var a; | 9 var a; |
| 10 static var s; | 10 static var s; |
| 11 | 11 |
| 12 static foo() { | 12 static foo() { |
| 13 return s; | 13 return s; |
| 14 } | 14 } |
| 15 | 15 |
| 16 A(x, y) : super(y), a = x { } | 16 A(x, y) |
| 17 : super(y), |
| 18 a = x {} |
| 17 | 19 |
| 18 value() { | 20 value() { |
| 19 return a + b + foo(); | 21 return a + b + foo(); |
| 20 } | 22 } |
| 21 } | 23 } |
| 22 | 24 |
| 23 | |
| 24 class B { | 25 class B { |
| 25 var b; | 26 var b; |
| 26 static var s; | 27 static var s; |
| 27 | 28 |
| 28 static foo(x) { | 29 static foo(x) { |
| 29 return x + s; | 30 return x + s; |
| 30 } | 31 } |
| 31 | 32 |
| 32 value() { | 33 value() { |
| 33 return b + foo(s) + A.foo(); | 34 return b + foo(s) + A.foo(); |
| 34 } | 35 } |
| 35 | 36 |
| 36 B(x) : b = x { | 37 B(x) : b = x { |
| 37 b = b + 1; | 38 b = b + 1; |
| 38 } | 39 } |
| 39 } | 40 } |
| 40 | 41 |
| 41 | |
| 42 class ThirdTest { | 42 class ThirdTest { |
| 43 static testMain() { | 43 static testMain() { |
| 44 var a = new A(1, 2); | 44 var a = new A(1, 2); |
| 45 var b = new B(3); | 45 var b = new B(3); |
| 46 A.s = 4; | 46 A.s = 4; |
| 47 B.s = 5; | 47 B.s = 5; |
| 48 Expect.equals(26, a.value() + b.value()); | 48 Expect.equals(26, a.value() + b.value()); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 main() { | 52 main() { |
| 53 ThirdTest.testMain(); | 53 ThirdTest.testMain(); |
| 54 } | 54 } |
| OLD | NEW |