Chromium Code Reviews| Index: tests/corelib/map_to_string_test.dart |
| diff --git a/tests/corelib/map_to_string_test.dart b/tests/corelib/map_to_string_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2200a0309bcb360fb22d060441f76fce1b58db6a |
| --- /dev/null |
| +++ b/tests/corelib/map_to_string_test.dart |
| @@ -0,0 +1,27 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +import "package:expect/expect.dart"; |
| + |
| +void main() { |
| + Map m = new Map(); |
| + |
| + m[0] = 0; |
| + m[1] = 1; |
| + m[2] = m; |
| + |
| + Expect.equals('{0: 0, 1: 1, 2: {...}}', m.toString()); |
| + |
| + m[1] = new ThrowOnToString(); |
| + Expect.throws(m.toString, (e) => e == "Bad!"); |
|
Lasse Reichstein Nielsen
2013/07/09 06:15:44
Try using ThrowOnToString as key as well.
zarah
2013/07/09 08:20:54
Done.
|
| + m[1] = 1; |
| + Expect.equals('{0: 0, 1: 1, 2: {...}}', m.toString()); |
| +} |
| + |
| +class ThrowOnToString { |
| + |
| + String toString() { |
| + throw "Bad!"; |
| + } |
| +} |