| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 // Test that `null` is interpreted as `false` when passed as argument to | |
| 6 // `caseSensitive` and `multiLine`. | |
| 7 | |
| 8 import 'package:expect/expect.dart'; | |
| 9 | |
| 10 main() { | |
| 11 testCaseSensitive(); | |
| 12 testMultiLine(); | |
| 13 } | |
| 14 | |
| 15 testCaseSensitive() { | |
| 16 var r1 = new RegExp('foo'); | |
| 17 var r2 = new RegExp('foo', caseSensitive: true); | |
| 18 var r3 = new RegExp('foo', caseSensitive: false); | |
| 19 var r4 = new RegExp('foo', caseSensitive: null); | |
| 20 Expect.isNull(r1.firstMatch('Foo'), "r1.firstMatch('Foo')"); | |
| 21 Expect.isNull(r2.firstMatch('Foo'), "r2.firstMatch('Foo')"); | |
| 22 Expect.isNotNull(r3.firstMatch('Foo'), "r3.firstMatch('Foo')"); | |
| 23 Expect.isNotNull(r4.firstMatch('Foo'), "r4.firstMatch('Foo')"); | |
| 24 } | |
| 25 | |
| 26 testMultiLine() { | |
| 27 var r1 = new RegExp(r'^foo$'); | |
| 28 var r2 = new RegExp(r'^foo$', multiLine: true); | |
| 29 var r3 = new RegExp(r'^foo$', multiLine: false); | |
| 30 var r4 = new RegExp(r'^foo$', multiLine: null); | |
| 31 Expect.isNull(r1.firstMatch('\nfoo\n'), "r1.firstMatch('\\nfoo\\n')"); | |
| 32 Expect.isNotNull(r2.firstMatch('\nfoo\n'), "r2.firstMatch('\\nfoo\\n')"); | |
| 33 Expect.isNull(r3.firstMatch('\nfoo\n'), "r3.firstMatch('\\nfoo\\n')"); | |
| 34 Expect.isNull(r4.firstMatch('\nfoo\n'), "r4.firstMatch('\\nfoo\\n')"); | |
| 35 } | |
| OLD | NEW |