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 // VMOptions=--enable_asserts | 4 // VMOptions=--enable_asserts |
5 // | |
6 // Dart test program testing assert statements. | 5 // Dart test program testing assert statements. |
| 6 import "package:expect/expect.dart"; |
7 | 7 |
8 class AssertTest { | 8 class AssertTest { |
9 static test() { | 9 static test() { |
10 try { | 10 try { |
11 assert(false); | 11 assert(false); |
12 Expect.fail("Assertion 'false' didn't fail."); | 12 Expect.fail("Assertion 'false' didn't fail."); |
13 } on AssertionError catch (error) { | 13 } on AssertionError catch (error) { |
14 Expect.equals("false", error.failedAssertion); | 14 Expect.equals("false", error.failedAssertion); |
15 int pos = error.url.lastIndexOf("/", error.url.length); | 15 int pos = error.url.lastIndexOf("/", error.url.length); |
16 if (pos == -1) { | 16 if (pos == -1) { |
(...skipping 24 matching lines...) Expand all Loading... |
41 | 41 |
42 static testMain() { | 42 static testMain() { |
43 test(); | 43 test(); |
44 testClosure(); | 44 testClosure(); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 main() { | 48 main() { |
49 AssertTest.testMain(); | 49 AssertTest.testMain(); |
50 } | 50 } |
OLD | NEW |