OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 4 |
5 class ExpandoTest { | 5 class ExpandoTest { |
6 static Expando<int> visits; | 6 static Expando<int> visits; |
7 | 7 |
8 static testMain() { | 8 static testMain() { |
9 visits = new Expando<int>('visits'); | 9 visits = new Expando<int>('visits'); |
10 var legal = [ new Object(), | 10 var legal = [ new Object(), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 expando[object] = 99; | 57 expando[object] = 99; |
58 Expect.equals(99, expando[object]); | 58 Expect.equals(99, expando[object]); |
59 Expect.equals(87, alternative[object]); | 59 Expect.equals(87, alternative[object]); |
60 } | 60 } |
61 | 61 |
62 static testIllegal() { | 62 static testIllegal() { |
63 Expando<int> expando = new Expando<int>(); | 63 Expando<int> expando = new Expando<int>(); |
64 Expect.throws(() => expando[null], (exception) | 64 Expect.throws(() => expando[null], (exception) |
65 => exception is NullPointerException); | 65 => exception is NullPointerException); |
66 Expect.throws(() => expando['string'], (exception) | 66 Expect.throws(() => expando['string'], (exception) |
67 => exception is IllegalArgumentException); | 67 => exception is ArgumentError); |
68 Expect.throws(() => expando['string'], (exception) | 68 Expect.throws(() => expando['string'], (exception) |
69 => exception is IllegalArgumentException); | 69 => exception is ArgumentError); |
70 Expect.throws(() => expando[42], (exception) | 70 Expect.throws(() => expando[42], (exception) |
71 => exception is IllegalArgumentException); | 71 => exception is ArgumentError); |
72 Expect.throws(() => expando[42.87], (exception) | 72 Expect.throws(() => expando[42.87], (exception) |
73 => exception is IllegalArgumentException); | 73 => exception is ArgumentError); |
74 Expect.throws(() => expando[true], (exception) | 74 Expect.throws(() => expando[true], (exception) |
75 => exception is IllegalArgumentException); | 75 => exception is ArgumentError); |
76 Expect.throws(() => expando[false], (exception) | 76 Expect.throws(() => expando[false], (exception) |
77 => exception is IllegalArgumentException); | 77 => exception is ArgumentError); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 main() => ExpandoTest.testMain(); | 81 main() => ExpandoTest.testMain(); |
OLD | NEW |