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

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

Issue 536453006: Don't use dart:io in the pkg/glob tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | 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 'dart:io';
6
7 import 'package:glob/glob.dart'; 5 import 'package:glob/glob.dart';
8 import 'package:path/path.dart' as p; 6 import 'package:path/path.dart' as p;
9 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
10 8
11 const ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEFGHIJ" 9 const ASCII_WITHOUT_SLASH = "\t\n\r !\"#\$%&'()*+`-.0123456789:;<=>?@ABCDEFGHIJ"
12 "KLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; 10 "KLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
13 11
14 void main() { 12 void main() {
15 test("literals match exactly", () { 13 test("literals match exactly", () {
16 expect("foo", contains(new Glob("foo"))); 14 expect("foo", contains(new Glob("foo")));
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 }); 218 });
221 }); 219 });
222 220
223 test("an absolute path can be matched by a relative glob", () { 221 test("an absolute path can be matched by a relative glob", () {
224 var path = p.absolute('foo/bar'); 222 var path = p.absolute('foo/bar');
225 expect(path, contains(new Glob("foo/bar"))); 223 expect(path, contains(new Glob("foo/bar")));
226 }); 224 });
227 225
228 test("a relative path can be matched by an absolute glob", () { 226 test("a relative path can be matched by an absolute glob", () {
229 var pattern = p.absolute('foo/bar'); 227 var pattern = p.absolute('foo/bar');
230 if (Platform.isWindows) pattern = pattern.replaceAll('\\', '/'); 228 if (p.style == p.Style.windows) pattern = pattern.replaceAll('\\', '/');
231 expect('foo/bar', contains(new Glob(pattern))); 229 expect('foo/bar', contains(new Glob(pattern)));
232 }); 230 });
233 231
234 group("with recursive: true", () { 232 group("with recursive: true", () {
235 var glob = new Glob("foo/bar", recursive: true); 233 var glob = new Glob("foo/bar", recursive: true);
236 234
237 test("still matches basic files", () { 235 test("still matches basic files", () {
238 expect("foo/bar", contains(glob)); 236 expect("foo/bar", contains(glob));
239 }); 237 });
240 238
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 expect(r"http://foo.com/bar", 275 expect(r"http://foo.com/bar",
278 contains(new Glob("http://**", context: p.url))); 276 contains(new Glob("http://**", context: p.url)));
279 expect(r"http://foo.com/bar", 277 expect(r"http://foo.com/bar",
280 contains(new Glob("http://foo.com/**", context: p.url))); 278 contains(new Glob("http://foo.com/**", context: p.url)));
281 279
282 expect("/foo/bar", contains(new Glob("/foo/bar", context: p.url))); 280 expect("/foo/bar", contains(new Glob("/foo/bar", context: p.url)));
283 expect("/foo/bar", isNot(contains(new Glob("**", context: p.url)))); 281 expect("/foo/bar", isNot(contains(new Glob("**", context: p.url))));
284 expect("/foo/bar", contains(new Glob("/**", context: p.url))); 282 expect("/foo/bar", contains(new Glob("/**", context: p.url)));
285 }); 283 });
286 } 284 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698