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 // Testing the Expect class. | 4 // Testing the Expect class. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 class ExpectTest { | 8 class ExpectTest { |
9 | |
10 static testEquals(a) { | 9 static testEquals(a) { |
11 try { | 10 try { |
12 Expect.equals("AB", a, "within testEquals"); | 11 Expect.equals("AB", a, "within testEquals"); |
13 } on Exception catch (msg) { | 12 } on Exception catch (msg) { |
14 print(msg); | 13 print(msg); |
15 return; | 14 return; |
16 } | 15 } |
17 Expect.equals("AB", "${a}B"); | 16 Expect.equals("AB", "${a}B"); |
18 throw "Expect.equals did not fail"; | 17 throw "Expect.equals did not fail"; |
19 } | 18 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 63 |
65 static void testMain() { | 64 static void testMain() { |
66 testEquals("A"); | 65 testEquals("A"); |
67 testIsTrue(false); | 66 testIsTrue(false); |
68 testIsTrue(1); | 67 testIsTrue(1); |
69 testIsFalse(true); | 68 testIsFalse(true); |
70 testIsFalse(0); | 69 testIsFalse(0); |
71 testIdentical("A"); | 70 testIdentical("A"); |
72 testFail(); | 71 testFail(); |
73 } | 72 } |
74 | |
75 } | 73 } |
76 | 74 |
77 main() { | 75 main() { |
78 ExpectTest.testMain(); | 76 ExpectTest.testMain(); |
79 } | 77 } |
OLD | NEW |