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

Side by Side Diff: test/parse_test.dart

Issue 861313003: glob pkg: fixed test, updated homepage url, added SDK constraint (Closed) Base URL: https://github.com/dart-lang/glob.git@master
Patch Set: nits Created 5 years, 11 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
« no previous file with comments | « pubspec.yaml ('k') | 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 'package:glob/glob.dart'; 5 import 'package:glob/glob.dart';
6 import 'package:path/path.dart' as p; 6 import 'package:path/path.dart' as p;
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 void main() { 9 void main() {
10 test("supports backslash-escaped characters", () { 10 test("supports backslash-escaped characters", () {
11 expect(r"*[]{,}?()", contains(new Glob(r"\*\[\]\{\,\}\?\(\)"))); 11 expect(r"*[]{,}?()", contains(new Glob(r"\*\[\]\{\,\}\?\(\)")));
12 if (p.style != p.Style.windows) { 12 if (p.style != p.Style.windows) {
13 expect(r"foo\bar", contains(new Glob(r"foo\\bar"))); 13 expect(r"foo\bar", contains(new Glob(r"foo\\bar")));
14 } 14 }
15 }); 15 });
16 16
17 test("disallows an empty glob", () { 17 test("disallows an empty glob", () {
18 expect(() => new Glob(""), throwsFormatException); 18 expect(() => new Glob(""), throwsFormatException);
19 }); 19 });
20 20
21 group("range", () { 21 group("range", () {
22 test("supports either ^ or ! for negated ranges", () { 22 test("supports either ^ or ! for negated ranges", () {
23 var bang = new Glob("fo[!a-z]"); 23 var bang = new Glob("fo[!a-z]");
24 expect("foo", isNot(contains(bang))); 24 expect("foo", isNot(contains(bang)));
25 expect("fo2", contains(bang)); 25 expect("fo2", contains(bang));
26 26
27 var caret = new Glob("fo[^a-z]"); 27 var caret = new Glob("fo[^a-z]");
28 expect("foo", isNot(contains(bang))); 28 expect("foo", isNot(contains(caret)));
29 expect("fo2", contains(bang)); 29 expect("fo2", contains(caret));
30 }); 30 });
31 31
32 test("supports backslash-escaped characters", () { 32 test("supports backslash-escaped characters", () {
33 var glob = new Glob(r"fo[\*\--\]]"); 33 var glob = new Glob(r"fo[\*\--\]]");
34 expect("fo]", contains(glob)); 34 expect("fo]", contains(glob));
35 expect("fo-", contains(glob)); 35 expect("fo-", contains(glob));
36 expect("fo*", contains(glob)); 36 expect("fo*", contains(glob));
37 }); 37 });
38 38
39 test("disallows inverted ranges", () { 39 test("disallows inverted ranges", () {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 test("disallows dangling ] in options", () { 87 test("disallows dangling ] in options", () {
88 expect(() => new Glob(r"{abc]}"), throwsFormatException); 88 expect(() => new Glob(r"{abc]}"), throwsFormatException);
89 }); 89 });
90 }); 90 });
91 91
92 test("disallows unescaped parens", () { 92 test("disallows unescaped parens", () {
93 expect(() => new Glob("foo(bar"), throwsFormatException); 93 expect(() => new Glob("foo(bar"), throwsFormatException);
94 expect(() => new Glob("foo)bar"), throwsFormatException); 94 expect(() => new Glob("foo)bar"), throwsFormatException);
95 }); 95 });
96 } 96 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698