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

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

Issue 607963002: Fix glob list on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/lib/src/utils.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 'dart:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:glob/glob.dart'; 8 import 'package:glob/glob.dart';
9 import 'package:glob/src/utils.dart'; 9 import 'package:glob/src/utils.dart';
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 {bool recursive, bool followLinks}); 258 {bool recursive, bool followLinks});
259 259
260 /// Runs [callback] in two groups with two values of [listFn]: one that uses 260 /// Runs [callback] in two groups with two values of [listFn]: one that uses
261 /// [Glob.list], one that uses [Glob.listSync]. 261 /// [Glob.list], one that uses [Glob.listSync].
262 void syncAndAsync(callback(ListFn listFn)) { 262 void syncAndAsync(callback(ListFn listFn)) {
263 group("async", () { 263 group("async", () {
264 callback((glob, {recursive: false, followLinks: true}) { 264 callback((glob, {recursive: false, followLinks: true}) {
265 return schedule(() { 265 return schedule(() {
266 return new Glob(glob, recursive: recursive) 266 return new Glob(glob, recursive: recursive)
267 .list(root: sandbox, followLinks: followLinks) 267 .list(root: sandbox, followLinks: followLinks)
268 .map((entity) { 268 .map((entity) => p.relative(entity.path, from: sandbox))
269 return separatorToForwardSlash( 269 .toList();
270 p.relative(entity.path, from: sandbox));
271 }).toList();
272 }, 'listing $glob'); 270 }, 'listing $glob');
273 }); 271 });
274 }); 272 });
275 273
276 group("sync", () { 274 group("sync", () {
277 callback((glob, {recursive: false, followLinks: true}) { 275 callback((glob, {recursive: false, followLinks: true}) {
278 return schedule(() { 276 return schedule(() {
279 return new Glob(glob, recursive: recursive) 277 return new Glob(glob, recursive: recursive)
280 .listSync(root: sandbox, followLinks: followLinks) 278 .listSync(root: sandbox, followLinks: followLinks)
281 .map((entity) { 279 .map((entity) => p.relative(entity.path, from: sandbox))
282 return separatorToForwardSlash( 280 .toList();
283 p.relative(entity.path, from: sandbox));
284 }).toList();
285 }, 'listing $glob'); 281 }, 'listing $glob');
286 }); 282 });
287 }); 283 });
288 } 284 }
289 285
290 void scheduleSandbox() { 286 void scheduleSandbox() {
291 schedule(() { 287 schedule(() {
292 return Directory.systemTemp.createTemp('glob_').then((dir) { 288 return Directory.systemTemp.createTemp('glob_').then((dir) {
293 sandbox = dir.path; 289 sandbox = dir.path;
294 d.defaultRoot = sandbox; 290 d.defaultRoot = sandbox;
295 }); 291 });
296 }, 'creating sandbox'); 292 }, 'creating sandbox');
297 293
298 currentSchedule.onComplete.schedule(() { 294 currentSchedule.onComplete.schedule(() {
299 d.defaultRoot = null; 295 d.defaultRoot = null;
300 if (sandbox == null) return null; 296 if (sandbox == null) return null;
301 var oldSandbox = sandbox; 297 var oldSandbox = sandbox;
302 sandbox = null; 298 sandbox = null;
303 return new Directory(oldSandbox).delete(recursive: true); 299 return new Directory(oldSandbox).delete(recursive: true);
304 }); 300 });
305 } 301 }
OLDNEW
« no previous file with comments | « pkg/glob/lib/src/utils.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698