OLD | NEW |
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 var pattern = separatorToForwardSlash( | 268 var pattern = separatorToForwardSlash( |
269 p.absolute(p.join(sandbox, 'foo/baz/**'))); | 269 p.absolute(p.join(sandbox, 'foo/baz/**'))); |
270 | 270 |
271 return list(pattern); | 271 return list(pattern); |
272 }), completion(unorderedEquals([ | 272 }), completion(unorderedEquals([ |
273 p.join("foo", "baz", "bang"), | 273 p.join("foo", "baz", "bang"), |
274 p.join("foo", "baz", "qux") | 274 p.join("foo", "baz", "qux") |
275 ]))); | 275 ]))); |
276 }); | 276 }); |
277 | 277 |
| 278 // Regression test for #4. |
| 279 test("lists an absolute case-insensitive glob", () { |
| 280 expect(schedule(() { |
| 281 var pattern = separatorToForwardSlash( |
| 282 p.absolute(p.join(sandbox, 'foo/Baz/**'))); |
| 283 |
| 284 return list(pattern, caseSensitive: false); |
| 285 }), completion(unorderedEquals([ |
| 286 p.join("foo", "baz", "bang"), |
| 287 p.join("foo", "baz", "qux") |
| 288 ]))); |
| 289 }); |
| 290 |
278 test("lists a subdirectory that sometimes exists", () { | 291 test("lists a subdirectory that sometimes exists", () { |
279 d.dir("top", [ | 292 d.dir("top", [ |
280 d.dir("dir1", [ | 293 d.dir("dir1", [ |
281 d.dir("subdir", [d.file("file")]) | 294 d.dir("subdir", [d.file("file")]) |
282 ]), | 295 ]), |
283 d.dir("dir2", []) | 296 d.dir("dir2", []) |
284 ]).create(); | 297 ]).create(); |
285 | 298 |
286 expect(list("top/*/subdir/**"), | 299 expect(list("top/*/subdir/**"), |
287 completion(equals([p.join("top", "dir1", "subdir", "file")]))); | 300 completion(equals([p.join("top", "dir1", "subdir", "file")]))); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 }, 'creating sandbox'); | 369 }, 'creating sandbox'); |
357 | 370 |
358 currentSchedule.onComplete.schedule(() { | 371 currentSchedule.onComplete.schedule(() { |
359 d.defaultRoot = null; | 372 d.defaultRoot = null; |
360 if (sandbox == null) return null; | 373 if (sandbox == null) return null; |
361 var oldSandbox = sandbox; | 374 var oldSandbox = sandbox; |
362 sandbox = null; | 375 sandbox = null; |
363 return new Directory(oldSandbox).delete(recursive: true); | 376 return new Directory(oldSandbox).delete(recursive: true); |
364 }); | 377 }); |
365 } | 378 } |
OLD | NEW |