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"; | |
7 | |
8 | 6 |
9 class A { | 7 class A { |
10 String val = ""; | 8 String val = ""; |
11 List things; | 9 List things; |
12 | 10 |
13 A() : things = ['D', 'a', 'r', 't', 42]; | 11 A() : things = ['D', 'a', 'r', 't', 42]; |
14 | 12 |
15 operator + (String s) { | 13 operator + (String s) { |
16 val = "${val}${s}"; | 14 val = "${val}${s}"; |
17 return this; | 15 return this; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 a += "Tell"; // operator + of class B. | 69 a += "Tell"; // operator + of class B. |
72 Expect.equals("TellTell", a.val); | 70 Expect.equals("TellTell", a.val); |
73 Expect.equals("rr", a[2]); // operator [] of class B. | 71 Expect.equals("rr", a[2]); // operator [] of class B. |
74 | 72 |
75 a[4] = 1; // operator []= of class B. | 73 a[4] = 1; // operator []= of class B. |
76 Expect.equals(43, a.things[4]); | 74 Expect.equals(43, a.things[4]); |
77 Expect.equals(86, a[4]); | 75 Expect.equals(86, a[4]); |
78 | 76 |
79 Expect.throws(testRegression6403); | 77 Expect.throws(testRegression6403); |
80 } | 78 } |
OLD | NEW |