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 regular expressions in Dart. | 4 // Dart test for testing regular expressions in Dart. |
5 | 5 |
6 import "package:expect/expect.dart"; | |
7 | |
8 main() { | 6 main() { |
9 try { | 7 try { |
10 RegExp ex = new RegExp(null); | 8 RegExp ex = new RegExp(null); |
11 Expect.fail("Expected: ArgumentError got: no exception"); | 9 Expect.fail("Expected: ArgumentError got: no exception"); |
12 } catch (ex) { | 10 } catch (ex) { |
13 if (!(ex is ArgumentError)) { | 11 if (!(ex is ArgumentError)) { |
14 Expect.fail("Expected: ArgumentError got: ${ex}"); | 12 Expect.fail("Expected: ArgumentError got: ${ex}"); |
15 } | 13 } |
16 } | 14 } |
17 try { | 15 try { |
(...skipping 22 matching lines...) Expand all Loading... |
40 } | 38 } |
41 try { | 39 try { |
42 new RegExp(r"^\w+$").stringMatch(null); | 40 new RegExp(r"^\w+$").stringMatch(null); |
43 Expect.fail("Expected: ArgumentError got: no exception"); | 41 Expect.fail("Expected: ArgumentError got: no exception"); |
44 } catch (ex) { | 42 } catch (ex) { |
45 if (!(ex is ArgumentError)) { | 43 if (!(ex is ArgumentError)) { |
46 Expect.fail("Expected: ArgumentError got: ${ex}"); | 44 Expect.fail("Expected: ArgumentError got: ${ex}"); |
47 } | 45 } |
48 } | 46 } |
49 } | 47 } |
OLD | NEW |