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 'package:glob/glob.dart'; | 5 import 'package:glob/glob.dart'; |
| 6 import 'package:path/path.dart' as p; |
6 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
7 | 8 |
8 void main() { | 9 void main() { |
9 test("supports backslash-escaped characters", () { | 10 test("supports backslash-escaped characters", () { |
10 expect(r"\*[]{,}?()", contains(new Glob(r"\\\*\[\]\{\,\}\?\(\)"))); | 11 expect(r"\*[]{,}?()", contains(new Glob(r"\\\*\[\]\{\,\}\?\(\)"))); |
| 12 if (p.style != p.Style.windows) { |
| 13 expect(r"foo\bar", contains(new Glob(r"foo\\bar"))); |
| 14 } |
11 }); | 15 }); |
12 | 16 |
13 test("disallows an empty glob", () { | 17 test("disallows an empty glob", () { |
14 expect(() => new Glob(""), throwsFormatException); | 18 expect(() => new Glob(""), throwsFormatException); |
15 }); | 19 }); |
16 | 20 |
17 group("range", () { | 21 group("range", () { |
18 test("supports either ^ or ! for negated ranges", () { | 22 test("supports either ^ or ! for negated ranges", () { |
19 var bang = new Glob("fo[!a-z]"); | 23 var bang = new Glob("fo[!a-z]"); |
20 expect("foo", isNot(contains(bang))); | 24 expect("foo", isNot(contains(bang))); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 test("disallows dangling ] in options", () { | 87 test("disallows dangling ] in options", () { |
84 expect(() => new Glob(r"{abc]}"), throwsFormatException); | 88 expect(() => new Glob(r"{abc]}"), throwsFormatException); |
85 }); | 89 }); |
86 }); | 90 }); |
87 | 91 |
88 test("disallows unescaped parens", () { | 92 test("disallows unescaped parens", () { |
89 expect(() => new Glob("foo(bar"), throwsFormatException); | 93 expect(() => new Glob("foo(bar"), throwsFormatException); |
90 expect(() => new Glob("foo)bar"), throwsFormatException); | 94 expect(() => new Glob("foo)bar"), throwsFormatException); |
91 }); | 95 }); |
92 } | 96 } |
OLD | NEW |