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

Unified Diff: test/match_test.dart

Issue 1491003002: Add a caseSensitive flag to new Glob(). (Closed) Base URL: git@github.com:dart-lang/glob@master
Patch Set: Code review changes Created 5 years 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/list_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/match_test.dart
diff --git a/test/match_test.dart b/test/match_test.dart
index 90b5b7f3380f8ccb2c049eebb5dfd8caf2b61450..13dc7d6554319828a29c92aced310787fd556075 100644
--- a/test/match_test.dart
+++ b/test/match_test.dart
@@ -291,4 +291,62 @@ void main() {
expect("/foo/bar", isNot(contains(new Glob("**", context: p.url))));
expect("/foo/bar", contains(new Glob("/**", context: p.url)));
});
+
+ group("when case-sensitive", () {
+ test("literals match case-sensitively", () {
+ expect("foo", contains(new Glob("foo", caseSensitive: true)));
+ expect("FOO", isNot(contains(new Glob("foo", caseSensitive: true))));
+ expect("foo", isNot(contains(new Glob("FOO", caseSensitive: true))));
+ });
+
+ test("ranges match case-sensitively", () {
+ expect("foo", contains(new Glob("[fx][a-z]o", caseSensitive: true)));
+ expect("FOO",
+ isNot(contains(new Glob("[fx][a-z]o", caseSensitive: true))));
+ expect("foo",
+ isNot(contains(new Glob("[FX][A-Z]O", caseSensitive: true))));
+ });
+
+ test("sequences preserve case-sensitivity", () {
+ expect("foo/bar", contains(new Glob("foo/bar", caseSensitive: true)));
+ expect("FOO/BAR",
+ isNot(contains(new Glob("foo/bar", caseSensitive: true))));
+ expect("foo/bar",
+ isNot(contains(new Glob("FOO/BAR", caseSensitive: true))));
+ });
+
+ test("options preserve case-sensitivity", () {
+ expect("foo", contains(new Glob("{foo,bar}", caseSensitive: true)));
+ expect("FOO",
+ isNot(contains(new Glob("{foo,bar}", caseSensitive: true))));
+ expect("foo",
+ isNot(contains(new Glob("{FOO,BAR}", caseSensitive: true))));
+ });
+ });
+
+ group("when case-insensitive", () {
+ test("literals match case-insensitively", () {
+ expect("foo", contains(new Glob("foo", caseSensitive: false)));
+ expect("FOO", contains(new Glob("foo", caseSensitive: false)));
+ expect("foo", contains(new Glob("FOO", caseSensitive: false)));
+ });
+
+ test("ranges match case-insensitively", () {
+ expect("foo", contains(new Glob("[fx][a-z]o", caseSensitive: false)));
+ expect("FOO", contains(new Glob("[fx][a-z]o", caseSensitive: false)));
+ expect("foo", contains(new Glob("[FX][A-Z]O", caseSensitive: false)));
+ });
+
+ test("sequences preserve case-insensitivity", () {
+ expect("foo/bar", contains(new Glob("foo/bar", caseSensitive: false)));
+ expect("FOO/BAR", contains(new Glob("foo/bar", caseSensitive: false)));
+ expect("foo/bar", contains(new Glob("FOO/BAR", caseSensitive: false)));
+ });
+
+ test("options preserve case-insensitivity", () {
+ expect("foo", contains(new Glob("{foo,bar}", caseSensitive: false)));
+ expect("FOO", contains(new Glob("{foo,bar}", caseSensitive: false)));
+ expect("foo", contains(new Glob("{FOO,BAR}", caseSensitive: false)));
+ });
+ });
}
« no previous file with comments | « test/list_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698