Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: test/codegen/corelib/regexp/default_arguments_test.dart

Issue 1945153002: Add corelib tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: error_test and range_error_test now pass Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/codegen/corelib/regexp/constructor_test.dart ('k') | test/codegen/corelib/regexp/dotstar_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/corelib/regexp/default_arguments_test.dart
diff --git a/test/codegen/corelib/regexp/default_arguments_test.dart b/test/codegen/corelib/regexp/default_arguments_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5b1d6e8f799dd1e486e023750351c30c5c3a71dc
--- /dev/null
+++ b/test/codegen/corelib/regexp/default_arguments_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test that `null` is interpreted as `false` when passed as argument to
+// `caseSensitive` and `multiLine`.
+
+import 'package:expect/expect.dart';
+
+main() {
+ testCaseSensitive();
+ testMultiLine();
+}
+
+testCaseSensitive() {
+ var r1 = new RegExp('foo');
+ var r2 = new RegExp('foo', caseSensitive: true);
+ var r3 = new RegExp('foo', caseSensitive: false);
+ var r4 = new RegExp('foo', caseSensitive: null);
+ Expect.isNull(r1.firstMatch('Foo'), "r1.firstMatch('Foo')");
+ Expect.isNull(r2.firstMatch('Foo'), "r2.firstMatch('Foo')");
+ Expect.isNotNull(r3.firstMatch('Foo'), "r3.firstMatch('Foo')");
+ Expect.isNotNull(r4.firstMatch('Foo'), "r4.firstMatch('Foo')");
+}
+
+testMultiLine() {
+ var r1 = new RegExp(r'^foo$');
+ var r2 = new RegExp(r'^foo$', multiLine: true);
+ var r3 = new RegExp(r'^foo$', multiLine: false);
+ var r4 = new RegExp(r'^foo$', multiLine: null);
+ Expect.isNull(r1.firstMatch('\nfoo\n'), "r1.firstMatch('\\nfoo\\n')");
+ Expect.isNotNull(r2.firstMatch('\nfoo\n'), "r2.firstMatch('\\nfoo\\n')");
+ Expect.isNull(r3.firstMatch('\nfoo\n'), "r3.firstMatch('\\nfoo\\n')");
+ Expect.isNull(r4.firstMatch('\nfoo\n'), "r4.firstMatch('\\nfoo\\n')");
+}
« no previous file with comments | « test/codegen/corelib/regexp/constructor_test.dart ('k') | test/codegen/corelib/regexp/dotstar_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698