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

Unified Diff: packages/glob/test/list_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 | « packages/glob/test/glob_test.dart ('k') | packages/glob/test/match_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/glob/test/list_test.dart
diff --git a/packages/glob/test/list_test.dart b/packages/glob/test/list_test.dart
index 33275243a759cec0b8746ef343f8c05c16f4735e..d59e273d0240a3d3cbb0755573a9a5480b0435a7 100644
--- a/packages/glob/test/list_test.dart
+++ b/packages/glob/test/list_test.dart
@@ -52,6 +52,29 @@ void main() {
});
});
+ group("when case-sensitive", () {
+ test("lists literals case-sensitively", () {
+ schedule(() {
+ expect(new Glob("foo/BAZ/qux", caseSensitive: true).listSync,
+ throwsA(new isInstanceOf<FileSystemException>()));
+ });
+ });
+
+ test("lists ranges case-sensitively", () {
+ schedule(() {
+ expect(new Glob("foo/[BX][A-Z]z/qux", caseSensitive: true).listSync,
+ throwsA(new isInstanceOf<FileSystemException>()));
+ });
+ });
+
+ test("options preserve case-sensitivity", () {
+ schedule(() {
+ expect(new Glob("foo/{BAZ,ZAP}/qux", caseSensitive: true).listSync,
+ throwsA(new isInstanceOf<FileSystemException>()));
+ });
+ });
+ });
+
syncAndAsync((list) {
group("literals", () {
test("lists a single literal", () {
@@ -252,6 +275,19 @@ void main() {
])));
});
+ // Regression test for #4.
+ test("lists an absolute case-insensitive glob", () {
+ expect(schedule(() {
+ var pattern = separatorToForwardSlash(
+ p.absolute(p.join(sandbox, 'foo/Baz/**')));
+
+ return list(pattern, caseSensitive: false);
+ }), completion(unorderedEquals([
+ p.join("foo", "baz", "bang"),
+ p.join("foo", "baz", "qux")
+ ])));
+ });
+
test("lists a subdirectory that sometimes exists", () {
d.dir("top", [
d.dir("dir1", [
@@ -263,34 +299,63 @@ void main() {
expect(list("top/*/subdir/**"),
completion(equals([p.join("top", "dir1", "subdir", "file")])));
});
+
+ group("when case-insensitive", () {
+ test("lists literals case-insensitively", () {
+ expect(list("foo/baz/qux", caseSensitive: false),
+ completion(equals([p.join("foo", "baz", "qux")])));
+ expect(list("foo/BAZ/qux", caseSensitive: false),
+ completion(equals([p.join("foo", "baz", "qux")])));
+ });
+
+ test("lists ranges case-insensitively", () {
+ expect(list("foo/[bx][a-z]z/qux", caseSensitive: false),
+ completion(equals([p.join("foo", "baz", "qux")])));
+ expect(list("foo/[BX][A-Z]z/qux", caseSensitive: false),
+ completion(equals([p.join("foo", "baz", "qux")])));
+ });
+
+ test("options preserve case-insensitivity", () {
+ expect(list("foo/{bar,baz}/qux", caseSensitive: false),
+ completion(equals([p.join("foo", "baz", "qux")])));
+ expect(list("foo/{BAR,BAZ}/qux", caseSensitive: false),
+ completion(equals([p.join("foo", "baz", "qux")])));
+ });
+ });
});
}
typedef Future<List<String>> ListFn(String glob,
- {bool recursive, bool followLinks});
+ {bool recursive, bool followLinks, bool caseSensitive});
/// Runs [callback] in two groups with two values of [listFn]: one that uses
/// [Glob.list], one that uses [Glob.listSync].
void syncAndAsync(callback(ListFn listFn)) {
group("async", () {
- callback((glob, {recursive: false, followLinks: true}) {
+ callback((pattern, {recursive: false, followLinks: true, caseSensitive}) {
return schedule(() {
- return new Glob(glob, recursive: recursive)
+ var glob = new Glob(pattern,
+ recursive: recursive, caseSensitive: caseSensitive);
+
+ return glob
.list(root: sandbox, followLinks: followLinks)
.map((entity) => p.relative(entity.path, from: sandbox))
.toList();
- }, 'listing $glob');
+ }, 'listing $pattern');
});
});
group("sync", () {
- callback((glob, {recursive: false, followLinks: true}) {
+ callback((pattern, {recursive: false, followLinks: true, caseSensitive}) {
return schedule(() {
- return new Glob(glob, recursive: recursive)
+ var glob = new Glob(pattern,
+ recursive: recursive, caseSensitive: caseSensitive);
+
+ return glob
.listSync(root: sandbox, followLinks: followLinks)
.map((entity) => p.relative(entity.path, from: sandbox))
.toList();
- }, 'listing $glob');
+ }, 'listing $pattern');
});
});
}
« no previous file with comments | « packages/glob/test/glob_test.dart ('k') | packages/glob/test/match_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698