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 // Dart test for testing super operator calls | 4 // Dart test for testing super operator calls |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 | 8 |
9 class A { | 9 class A { |
10 String val = ""; | 10 String val = ""; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 main () { | 64 main () { |
65 var a = new A(); | 65 var a = new A(); |
66 a = a + "William"; // operator + of class A. | 66 a = a + "William"; // operator + of class A. |
67 Expect.equals("William", a.val); | 67 Expect.equals("William", a.val); |
68 Expect.equals("r", a[2]); // operator [] of class A. | 68 Expect.equals("r", a[2]); // operator [] of class A. |
69 | 69 |
70 a = new B(); | 70 a = new B(); |
71 a += "Tell"; // operator + of class B. | 71 a += "Tell"; // operator + of class B. |
72 Expect.equals("TellTell", a.val); | 72 Expect.equals("TellTell", a.val); |
73 Expect.equals("rr", a[2]); // operator [] of class B. | 73 Expect.equals("rr", a[2]); // operator [] of class B. |
74 | 74 |
75 a[4] = 1; // operator []= of class B. | 75 a[4] = 1; // operator []= of class B. |
76 Expect.equals(43, a.things[4]); | 76 Expect.equals(43, a.things[4]); |
77 Expect.equals(86, a[4]); | 77 Expect.equals(86, a[4]); |
78 | 78 |
79 Expect.throws(testRegression6403); | 79 Expect.throws(testRegression6403); |
80 } | 80 } |
OLD | NEW |