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

Side by Side Diff: pkg/glob/test/match_test.dart

Issue 549633002: Add support for listing to the glob package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/glob/test/list_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 4
5 import 'package:glob/glob.dart'; 5 import 'package:glob/glob.dart';
6 import 'package:glob/src/utils.dart';
6 import 'package:path/path.dart' as p; 7 import 'package:path/path.dart' as p;
7 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
8 9
9 const RAW_ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEF" 10 const RAW_ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEF"
10 "GHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"; 11 "GHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
11 12
12 // URL-encode the path for a URL context. 13 // URL-encode the path for a URL context.
13 final asciiWithoutSlash = p.style == p.Style.url ? 14 final asciiWithoutSlash = p.style == p.Style.url ?
14 Uri.encodeFull(RAW_ASCII_WITHOUT_SLASH) : RAW_ASCII_WITHOUT_SLASH; 15 Uri.encodeFull(RAW_ASCII_WITHOUT_SLASH) : RAW_ASCII_WITHOUT_SLASH;
15 16
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 contains(new Glob("foo/bar/baz", context: p.windows))); 228 contains(new Glob("foo/bar/baz", context: p.windows)));
228 }); 229 });
229 }); 230 });
230 231
231 test("an absolute path can be matched by a relative glob", () { 232 test("an absolute path can be matched by a relative glob", () {
232 var path = p.absolute('foo/bar'); 233 var path = p.absolute('foo/bar');
233 expect(path, contains(new Glob("foo/bar"))); 234 expect(path, contains(new Glob("foo/bar")));
234 }); 235 });
235 236
236 test("a relative path can be matched by an absolute glob", () { 237 test("a relative path can be matched by an absolute glob", () {
237 var pattern = p.absolute('foo/bar'); 238 var pattern = separatorToForwardSlash(p.absolute('foo/bar'));
238 if (p.style == p.Style.windows) pattern = pattern.replaceAll('\\', '/');
239 expect('foo/bar', contains(new Glob(pattern))); 239 expect('foo/bar', contains(new Glob(pattern)));
240 }); 240 });
241 241
242 group("with recursive: true", () { 242 group("with recursive: true", () {
243 var glob = new Glob("foo/bar", recursive: true); 243 var glob = new Glob("foo/bar", recursive: true);
244 244
245 test("still matches basic files", () { 245 test("still matches basic files", () {
246 expect("foo/bar", contains(glob)); 246 expect("foo/bar", contains(glob));
247 }); 247 });
248 248
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 expect(r"http://foo.com/bar", 285 expect(r"http://foo.com/bar",
286 contains(new Glob("http://**", context: p.url))); 286 contains(new Glob("http://**", context: p.url)));
287 expect(r"http://foo.com/bar", 287 expect(r"http://foo.com/bar",
288 contains(new Glob("http://foo.com/**", context: p.url))); 288 contains(new Glob("http://foo.com/**", context: p.url)));
289 289
290 expect("/foo/bar", contains(new Glob("/foo/bar", context: p.url))); 290 expect("/foo/bar", contains(new Glob("/foo/bar", context: p.url)));
291 expect("/foo/bar", isNot(contains(new Glob("**", context: p.url)))); 291 expect("/foo/bar", isNot(contains(new Glob("**", context: p.url))));
292 expect("/foo/bar", contains(new Glob("/**", context: p.url))); 292 expect("/foo/bar", contains(new Glob("/**", context: p.url)));
293 }); 293 });
294 } 294 }
OLDNEW
« no previous file with comments | « pkg/glob/test/list_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698