minimatch 0.2.8 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/minimatch.js +7 -5
- package/package.json +3 -2
- package/test/basic.js +366 -264
- package/.travis.yml +0 -4
package/minimatch.js
CHANGED
|
@@ -6,6 +6,9 @@ else exports.minimatch = minimatch
|
|
|
6
6
|
if (!require) {
|
|
7
7
|
require = function (id) {
|
|
8
8
|
switch (id) {
|
|
9
|
+
case "sigmund": return function sigmund (obj) {
|
|
10
|
+
return JSON.stringify(obj)
|
|
11
|
+
}
|
|
9
12
|
case "path": return { basename: function (f) {
|
|
10
13
|
f = f.split(/[\/\\]/)
|
|
11
14
|
var e = f.pop()
|
|
@@ -32,6 +35,7 @@ minimatch.Minimatch = Minimatch
|
|
|
32
35
|
var LRU = require("lru-cache")
|
|
33
36
|
, cache = minimatch.cache = new LRU({max: 100})
|
|
34
37
|
, GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
|
38
|
+
, sigmund = require("sigmund")
|
|
35
39
|
|
|
36
40
|
var path = require("path")
|
|
37
41
|
// any single thing other than /
|
|
@@ -157,9 +161,7 @@ function Minimatch (pattern, options) {
|
|
|
157
161
|
// lru storage.
|
|
158
162
|
// these things aren't particularly big, but walking down the string
|
|
159
163
|
// and turning it into a regexp can get pretty costly.
|
|
160
|
-
var cacheKey = pattern + "\n" +
|
|
161
|
-
return options[k]
|
|
162
|
-
}).join(":")
|
|
164
|
+
var cacheKey = pattern + "\n" + sigmund(options)
|
|
163
165
|
var cached = minimatch.cache.get(cacheKey)
|
|
164
166
|
if (cached) return cached
|
|
165
167
|
minimatch.cache.set(cacheKey, this)
|
|
@@ -479,7 +481,7 @@ function parse (pattern, isSub) {
|
|
|
479
481
|
if (pattern === "") return ""
|
|
480
482
|
|
|
481
483
|
var re = ""
|
|
482
|
-
, hasMagic =
|
|
484
|
+
, hasMagic = !!options.nocase
|
|
483
485
|
, escaping = false
|
|
484
486
|
// ? => one single character
|
|
485
487
|
, patternListStack = []
|
|
@@ -802,7 +804,7 @@ function makeRe () {
|
|
|
802
804
|
|
|
803
805
|
// must match entire pattern
|
|
804
806
|
// ending in a * or ** will make it less strict.
|
|
805
|
-
re = "^" + re + "$"
|
|
807
|
+
re = "^(?:" + re + ")$"
|
|
806
808
|
|
|
807
809
|
// can match anything, as long as it's not this.
|
|
808
810
|
if (this.negate) re = "^(?!" + re + ").*$"
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
|
3
3
|
"name": "minimatch",
|
|
4
4
|
"description": "a glob matcher in javascript",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.12",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git://github.com/isaacs/minimatch.git"
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"node": "*"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"lru-cache": "
|
|
18
|
+
"lru-cache": "2",
|
|
19
|
+
"sigmund": "~1.0.0"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"tap": ""
|
package/test/basic.js
CHANGED
|
@@ -13,274 +13,376 @@ var tap = require("tap")
|
|
|
13
13
|
, next = files.concat([ "a-b", "aXb"
|
|
14
14
|
, ".x", ".y" ])
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
var patterns =
|
|
18
|
+
[ "http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test"
|
|
19
|
+
, ["a*", ["a", "abc", "abd", "abe"]]
|
|
20
|
+
, ["X*", ["X*"], {nonull: true}]
|
|
21
|
+
|
|
22
|
+
// allow null glob expansion
|
|
23
|
+
, ["X*", []]
|
|
24
|
+
|
|
25
|
+
// isaacs: Slightly different than bash/sh/ksh
|
|
26
|
+
// \\* is not un-escaped to literal "*" in a failed match,
|
|
27
|
+
// but it does make it get treated as a literal star
|
|
28
|
+
, ["\\*", ["\\*"], {nonull: true}]
|
|
29
|
+
, ["\\**", ["\\**"], {nonull: true}]
|
|
30
|
+
, ["\\*\\*", ["\\*\\*"], {nonull: true}]
|
|
31
|
+
|
|
32
|
+
, ["b*/", ["bdir/"]]
|
|
33
|
+
, ["c*", ["c", "ca", "cb"]]
|
|
34
|
+
, ["**", files]
|
|
35
|
+
|
|
36
|
+
, ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
|
|
37
|
+
, ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
|
|
38
|
+
|
|
39
|
+
, "legendary larry crashes bashes"
|
|
40
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
|
|
41
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
|
|
42
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
|
|
43
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
|
|
44
|
+
|
|
45
|
+
, "character classes"
|
|
46
|
+
, ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
|
|
47
|
+
, ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
|
|
48
|
+
"bdir/", "ca", "cb", "dd", "de"]]
|
|
49
|
+
, ["a*[^c]", ["abd", "abe"]]
|
|
50
|
+
, function () { files.push("a-b", "aXb") }
|
|
51
|
+
, ["a[X-]b", ["a-b", "aXb"]]
|
|
52
|
+
, function () { files.push(".x", ".y") }
|
|
53
|
+
, ["[^a-c]*", ["d", "dd", "de"]]
|
|
54
|
+
, function () { files.push("a*b/", "a*b/ooo") }
|
|
55
|
+
, ["a\\*b/*", ["a*b/ooo"]]
|
|
56
|
+
, ["a\\*?/*", ["a*b/ooo"]]
|
|
57
|
+
, ["*\\\\!*", [], {null: true}, ["echo !7"]]
|
|
58
|
+
, ["*\\!*", ["echo !7"], null, ["echo !7"]]
|
|
59
|
+
, ["*.\\*", ["r.*"], null, ["r.*"]]
|
|
60
|
+
, ["a[b]c", ["abc"]]
|
|
61
|
+
, ["a[\\b]c", ["abc"]]
|
|
62
|
+
, ["a?c", ["abc"]]
|
|
63
|
+
, ["a\\*c", [], {null: true}, ["abc"]]
|
|
64
|
+
, ["", [""], { null: true }, [""]]
|
|
65
|
+
|
|
66
|
+
, "http://www.opensource.apple.com/source/bash/bash-23/" +
|
|
67
|
+
"bash/tests/glob-test"
|
|
68
|
+
, function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
|
|
69
|
+
, ["*/man*/bash.*", ["man/man1/bash.1"]]
|
|
70
|
+
, ["man/man1/bash.1", ["man/man1/bash.1"]]
|
|
71
|
+
, ["a***c", ["abc"], null, ["abc"]]
|
|
72
|
+
, ["a*****?c", ["abc"], null, ["abc"]]
|
|
73
|
+
, ["?*****??", ["abc"], null, ["abc"]]
|
|
74
|
+
, ["*****??", ["abc"], null, ["abc"]]
|
|
75
|
+
, ["?*****?c", ["abc"], null, ["abc"]]
|
|
76
|
+
, ["?***?****c", ["abc"], null, ["abc"]]
|
|
77
|
+
, ["?***?****?", ["abc"], null, ["abc"]]
|
|
78
|
+
, ["?***?****", ["abc"], null, ["abc"]]
|
|
79
|
+
, ["*******c", ["abc"], null, ["abc"]]
|
|
80
|
+
, ["*******?", ["abc"], null, ["abc"]]
|
|
81
|
+
, ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
82
|
+
, ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
83
|
+
, ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
84
|
+
, ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
85
|
+
, ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
86
|
+
, ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
87
|
+
, ["[-abc]", ["-"], null, ["-"]]
|
|
88
|
+
, ["[abc-]", ["-"], null, ["-"]]
|
|
89
|
+
, ["\\", ["\\"], null, ["\\"]]
|
|
90
|
+
, ["[\\\\]", ["\\"], null, ["\\"]]
|
|
91
|
+
, ["[[]", ["["], null, ["["]]
|
|
92
|
+
, ["[", ["["], null, ["["]]
|
|
93
|
+
, ["[*", ["[abc"], null, ["[abc"]]
|
|
94
|
+
, "a right bracket shall lose its special meaning and\n" +
|
|
95
|
+
"represent itself in a bracket expression if it occurs\n" +
|
|
96
|
+
"first in the list. -- POSIX.2 2.8.3.2"
|
|
97
|
+
, ["[]]", ["]"], null, ["]"]]
|
|
98
|
+
, ["[]-]", ["]"], null, ["]"]]
|
|
99
|
+
, ["[a-\z]", ["p"], null, ["p"]]
|
|
100
|
+
, ["??**********?****?", [], { null: true }, ["abc"]]
|
|
101
|
+
, ["??**********?****c", [], { null: true }, ["abc"]]
|
|
102
|
+
, ["?************c****?****", [], { null: true }, ["abc"]]
|
|
103
|
+
, ["*c*?**", [], { null: true }, ["abc"]]
|
|
104
|
+
, ["a*****c*?**", [], { null: true }, ["abc"]]
|
|
105
|
+
, ["a********???*******", [], { null: true }, ["abc"]]
|
|
106
|
+
, ["[]", [], { null: true }, ["a"]]
|
|
107
|
+
, ["[abc", [], { null: true }, ["["]]
|
|
108
|
+
|
|
109
|
+
, "nocase tests"
|
|
110
|
+
, ["XYZ", ["xYz"], { nocase: true, null: true }
|
|
111
|
+
, ["xYz", "ABC", "IjK"]]
|
|
112
|
+
, ["ab*", ["ABC"], { nocase: true, null: true }
|
|
113
|
+
, ["xYz", "ABC", "IjK"]]
|
|
114
|
+
, ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
|
|
115
|
+
, ["xYz", "ABC", "IjK"]]
|
|
116
|
+
|
|
117
|
+
// [ pattern, [matches], MM opts, files, TAP opts]
|
|
118
|
+
, "onestar/twostar"
|
|
119
|
+
, ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
|
|
120
|
+
, ["{/?,*}", ["/a", "bb"], {null: true}
|
|
121
|
+
, ["/a", "/b/b", "/a/b/c", "bb"]]
|
|
122
|
+
|
|
123
|
+
, "dots should not match unless requested"
|
|
124
|
+
, ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
|
|
125
|
+
|
|
126
|
+
// .. and . can only match patterns starting with .,
|
|
127
|
+
// even when options.dot is set.
|
|
128
|
+
, function () {
|
|
129
|
+
files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
|
|
130
|
+
}
|
|
131
|
+
, ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
|
|
132
|
+
, ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
|
|
133
|
+
, ["a/*/b", ["a/c/b"], {dot:false}]
|
|
134
|
+
, ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// this also tests that changing the options needs
|
|
138
|
+
// to change the cache key, even if the pattern is
|
|
139
|
+
// the same!
|
|
140
|
+
, ["**", ["a/b","a/.d",".a/.d"], { dot: true }
|
|
141
|
+
, [ ".a/.d", "a/.d", "a/b"]]
|
|
142
|
+
|
|
143
|
+
, "paren sets cannot contain slashes"
|
|
144
|
+
, ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
|
|
145
|
+
|
|
146
|
+
// brace sets trump all else.
|
|
147
|
+
//
|
|
148
|
+
// invalid glob pattern. fails on bash4 and bsdglob.
|
|
149
|
+
// however, in this implementation, it's easier just
|
|
150
|
+
// to do the intuitive thing, and let brace-expansion
|
|
151
|
+
// actually come before parsing any extglob patterns,
|
|
152
|
+
// like the documentation seems to say.
|
|
153
|
+
//
|
|
154
|
+
// XXX: if anyone complains about this, either fix it
|
|
155
|
+
// or tell them to grow up and stop complaining.
|
|
156
|
+
//
|
|
157
|
+
// bash/bsdglob says this:
|
|
158
|
+
// , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
|
|
159
|
+
// but we do this instead:
|
|
160
|
+
, ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
|
|
161
|
+
|
|
162
|
+
// test partial parsing in the presence of comment/negation chars
|
|
163
|
+
, ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
|
|
164
|
+
, ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
|
|
165
|
+
|
|
166
|
+
// like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
|
|
167
|
+
, ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
|
|
168
|
+
, ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
|
|
169
|
+
, {}
|
|
170
|
+
, ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
// crazy nested {,,} and *(||) tests.
|
|
174
|
+
, function () {
|
|
175
|
+
files = [ "a", "b", "c", "d"
|
|
176
|
+
, "ab", "ac", "ad"
|
|
177
|
+
, "bc", "cb"
|
|
178
|
+
, "bc,d", "c,db", "c,d"
|
|
179
|
+
, "d)", "(b|c", "*(b|c"
|
|
180
|
+
, "b|c", "b|cc", "cb|c"
|
|
181
|
+
, "x(a|b|c)", "x(a|c)"
|
|
182
|
+
, "(a|b|c)", "(a|c)"]
|
|
183
|
+
}
|
|
184
|
+
, ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
|
|
185
|
+
, ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
|
|
186
|
+
// a
|
|
187
|
+
// *(b|c)
|
|
188
|
+
// *(b|d)
|
|
189
|
+
, ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
|
|
190
|
+
, ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
// test various flag settings.
|
|
194
|
+
, [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
|
|
195
|
+
, { noext: true } ]
|
|
196
|
+
, ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
|
|
197
|
+
, ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
|
|
198
|
+
, ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
// begin channelling Boole and deMorgan...
|
|
202
|
+
, "negation tests"
|
|
203
|
+
, function () {
|
|
204
|
+
files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// anything that is NOT a* matches.
|
|
208
|
+
, ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
|
|
209
|
+
|
|
210
|
+
// anything that IS !a* matches.
|
|
211
|
+
, ["!a*", ["!ab", "!abc"], {nonegate: true}]
|
|
212
|
+
|
|
213
|
+
// anything that IS a* matches
|
|
214
|
+
, ["!!a*", ["a!b"]]
|
|
215
|
+
|
|
216
|
+
// anything that is NOT !a* matches
|
|
217
|
+
, ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
|
|
218
|
+
|
|
219
|
+
// negation nestled within a pattern
|
|
220
|
+
, function () {
|
|
221
|
+
files = [ "foo.js"
|
|
222
|
+
, "foo.bar"
|
|
223
|
+
// can't match this one without negative lookbehind.
|
|
224
|
+
, "foo.js.js"
|
|
225
|
+
, "blar.js"
|
|
226
|
+
, "foo."
|
|
227
|
+
, "boo.js.boo" ]
|
|
228
|
+
}
|
|
229
|
+
, ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
|
|
230
|
+
|
|
231
|
+
// https://github.com/isaacs/minimatch/issues/5
|
|
232
|
+
, function () {
|
|
233
|
+
files = [ 'a/b/.x/c'
|
|
234
|
+
, 'a/b/.x/c/d'
|
|
235
|
+
, 'a/b/.x/c/d/e'
|
|
236
|
+
, 'a/b/.x'
|
|
237
|
+
, 'a/b/.x/'
|
|
238
|
+
, 'a/.x/b'
|
|
239
|
+
, '.x'
|
|
240
|
+
, '.x/'
|
|
241
|
+
, '.x/a'
|
|
242
|
+
, '.x/a/b'
|
|
243
|
+
, 'a/.x/b/.x/c'
|
|
244
|
+
, '.x/.x' ]
|
|
245
|
+
}
|
|
246
|
+
, ["**/.x/**", [ '.x/'
|
|
247
|
+
, '.x/a'
|
|
248
|
+
, '.x/a/b'
|
|
249
|
+
, 'a/.x/b'
|
|
250
|
+
, 'a/b/.x/'
|
|
251
|
+
, 'a/b/.x/c'
|
|
252
|
+
, 'a/b/.x/c/d'
|
|
253
|
+
, 'a/b/.x/c/d/e' ] ]
|
|
254
|
+
|
|
255
|
+
]
|
|
256
|
+
|
|
257
|
+
var regexps =
|
|
258
|
+
[ '/^(?:(?=.)a[^/]*?)$/',
|
|
259
|
+
'/^(?:(?=.)X[^/]*?)$/',
|
|
260
|
+
'/^(?:(?=.)X[^/]*?)$/',
|
|
261
|
+
'/^(?:\\*)$/',
|
|
262
|
+
'/^(?:(?=.)\\*[^/]*?)$/',
|
|
263
|
+
'/^(?:\\*\\*)$/',
|
|
264
|
+
'/^(?:(?=.)b[^/]*?\\/)$/',
|
|
265
|
+
'/^(?:(?=.)c[^/]*?)$/',
|
|
266
|
+
'/^(?:(?:(?!(?:\\/|^)\\.).)*?)$/',
|
|
267
|
+
'/^(?:\\.\\.\\/(?!\\.)(?=.)[^/]*?\\/)$/',
|
|
268
|
+
'/^(?:s\\/(?=.)\\.\\.[^/]*?\\/)$/',
|
|
269
|
+
'/^(?:\\/\\^root:\\/\\{s\\/(?=.)\\^[^:][^/]*?:[^:][^/]*?:\\([^:]\\)[^/]*?\\.[^/]*?\\$\\/1\\/)$/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|(?!\\.)(?=.)(?:a|c)*)$/',
|
|
339
|
+
'/^(?:a|(?!\\.)(?=.)[^/]*?\\(b\\|c|d\\))$/',
|
|
340
|
+
'/^(?:a|(?!\\.)(?=.)(?:b|c)*|(?!\\.)(?=.)(?:b|d)*)$/',
|
|
341
|
+
'/^(?:(?!\\.)(?=.)(?:a|b|c)*|(?!\\.)(?=.)(?:a|c)*)$/',
|
|
342
|
+
'/^(?:(?!\\.)(?=.)[^/]*?\\(a\\|b\\|c\\)|(?!\\.)(?=.)[^/]*?\\(a\\|c\\))$/',
|
|
343
|
+
'/^(?:(?=.)a[^/]b)$/',
|
|
344
|
+
'/^(?:(?=.)#[^/]*?)$/',
|
|
345
|
+
'/^(?!^(?:(?=.)a[^/]*?)$).*$/',
|
|
346
|
+
'/^(?:(?=.)\\!a[^/]*?)$/',
|
|
347
|
+
'/^(?:(?=.)a[^/]*?)$/',
|
|
348
|
+
'/^(?!^(?:(?=.)\\!a[^/]*?)$).*$/',
|
|
349
|
+
'/^(?:(?!\\.)(?=.)[^/]*?\\.(?:(?!js)[^/]*?))$/',
|
|
350
|
+
'/^(?:(?:(?!(?:\\/|^)\\.).)*?\\/\\.x\\/(?:(?!(?:\\/|^)\\.).)*?)$/' ]
|
|
351
|
+
var re = 0;
|
|
352
|
+
|
|
16
353
|
tap.test("basic tests", function (t) {
|
|
17
354
|
var start = Date.now()
|
|
18
355
|
|
|
19
356
|
// [ pattern, [matches], MM opts, files, TAP opts]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
, ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
|
|
50
|
-
, ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
|
|
51
|
-
"bdir/", "ca", "cb", "dd", "de"]]
|
|
52
|
-
, ["a*[^c]", ["abd", "abe"]]
|
|
53
|
-
, function () { files.push("a-b", "aXb") }
|
|
54
|
-
, ["a[X-]b", ["a-b", "aXb"]]
|
|
55
|
-
, function () { files.push(".x", ".y") }
|
|
56
|
-
, ["[^a-c]*", ["d", "dd", "de"]]
|
|
57
|
-
, function () { files.push("a*b/", "a*b/ooo") }
|
|
58
|
-
, ["a\\*b/*", ["a*b/ooo"]]
|
|
59
|
-
, ["a\\*?/*", ["a*b/ooo"]]
|
|
60
|
-
, ["*\\\\!*", [], {null: true}, ["echo !7"]]
|
|
61
|
-
, ["*\\!*", ["echo !7"], null, ["echo !7"]]
|
|
62
|
-
, ["*.\\*", ["r.*"], null, ["r.*"]]
|
|
63
|
-
, ["a[b]c", ["abc"]]
|
|
64
|
-
, ["a[\\b]c", ["abc"]]
|
|
65
|
-
, ["a?c", ["abc"]]
|
|
66
|
-
, ["a\\*c", [], {null: true}, ["abc"]]
|
|
67
|
-
, ["", [""], { null: true }, [""]]
|
|
68
|
-
|
|
69
|
-
, "http://www.opensource.apple.com/source/bash/bash-23/" +
|
|
70
|
-
"bash/tests/glob-test"
|
|
71
|
-
, function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
|
|
72
|
-
, ["*/man*/bash.*", ["man/man1/bash.1"]]
|
|
73
|
-
, ["man/man1/bash.1", ["man/man1/bash.1"]]
|
|
74
|
-
, ["a***c", ["abc"], null, ["abc"]]
|
|
75
|
-
, ["a*****?c", ["abc"], null, ["abc"]]
|
|
76
|
-
, ["?*****??", ["abc"], null, ["abc"]]
|
|
77
|
-
, ["*****??", ["abc"], null, ["abc"]]
|
|
78
|
-
, ["?*****?c", ["abc"], null, ["abc"]]
|
|
79
|
-
, ["?***?****c", ["abc"], null, ["abc"]]
|
|
80
|
-
, ["?***?****?", ["abc"], null, ["abc"]]
|
|
81
|
-
, ["?***?****", ["abc"], null, ["abc"]]
|
|
82
|
-
, ["*******c", ["abc"], null, ["abc"]]
|
|
83
|
-
, ["*******?", ["abc"], null, ["abc"]]
|
|
84
|
-
, ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
85
|
-
, ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
86
|
-
, ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
87
|
-
, ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
88
|
-
, ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
89
|
-
, ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
|
90
|
-
, ["[-abc]", ["-"], null, ["-"]]
|
|
91
|
-
, ["[abc-]", ["-"], null, ["-"]]
|
|
92
|
-
, ["\\", ["\\"], null, ["\\"]]
|
|
93
|
-
, ["[\\\\]", ["\\"], null, ["\\"]]
|
|
94
|
-
, ["[[]", ["["], null, ["["]]
|
|
95
|
-
, ["[", ["["], null, ["["]]
|
|
96
|
-
, ["[*", ["[abc"], null, ["[abc"]]
|
|
97
|
-
, "a right bracket shall lose its special meaning and\n" +
|
|
98
|
-
"represent itself in a bracket expression if it occurs\n" +
|
|
99
|
-
"first in the list. -- POSIX.2 2.8.3.2"
|
|
100
|
-
, ["[]]", ["]"], null, ["]"]]
|
|
101
|
-
, ["[]-]", ["]"], null, ["]"]]
|
|
102
|
-
, ["[a-\z]", ["p"], null, ["p"]]
|
|
103
|
-
, ["??**********?****?", [], { null: true }, ["abc"]]
|
|
104
|
-
, ["??**********?****c", [], { null: true }, ["abc"]]
|
|
105
|
-
, ["?************c****?****", [], { null: true }, ["abc"]]
|
|
106
|
-
, ["*c*?**", [], { null: true }, ["abc"]]
|
|
107
|
-
, ["a*****c*?**", [], { null: true }, ["abc"]]
|
|
108
|
-
, ["a********???*******", [], { null: true }, ["abc"]]
|
|
109
|
-
, ["[]", [], { null: true }, ["a"]]
|
|
110
|
-
, ["[abc", [], { null: true }, ["["]]
|
|
111
|
-
|
|
112
|
-
, "nocase tests"
|
|
113
|
-
, ["XYZ", ["xYz"], { nocase: true, null: true }
|
|
114
|
-
, ["xYz", "ABC", "IjK"]]
|
|
115
|
-
, ["ab*", ["ABC"], { nocase: true, null: true }
|
|
116
|
-
, ["xYz", "ABC", "IjK"]]
|
|
117
|
-
, ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
|
|
118
|
-
, ["xYz", "ABC", "IjK"]]
|
|
119
|
-
|
|
120
|
-
// [ pattern, [matches], MM opts, files, TAP opts]
|
|
121
|
-
, "onestar/twostar"
|
|
122
|
-
, ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
|
|
123
|
-
, ["{/?,*}", ["/a", "bb"], {null: true}
|
|
124
|
-
, ["/a", "/b/b", "/a/b/c", "bb"]]
|
|
125
|
-
|
|
126
|
-
, "dots should not match unless requested"
|
|
127
|
-
, ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
|
|
128
|
-
|
|
129
|
-
// .. and . can only match patterns starting with .,
|
|
130
|
-
// even when options.dot is set.
|
|
131
|
-
, function () {
|
|
132
|
-
files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
|
|
133
|
-
}
|
|
134
|
-
, ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
|
|
135
|
-
, ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
|
|
136
|
-
, ["a/*/b", ["a/c/b"], {dot:false}]
|
|
137
|
-
, ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
// this also tests that changing the options needs
|
|
141
|
-
// to change the cache key, even if the pattern is
|
|
142
|
-
// the same!
|
|
143
|
-
, ["**", ["a/b","a/.d",".a/.d"], { dot: true }
|
|
144
|
-
, [ ".a/.d", "a/.d", "a/b"]]
|
|
145
|
-
|
|
146
|
-
, "paren sets cannot contain slashes"
|
|
147
|
-
, ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
|
|
148
|
-
|
|
149
|
-
// brace sets trump all else.
|
|
150
|
-
//
|
|
151
|
-
// invalid glob pattern. fails on bash4 and bsdglob.
|
|
152
|
-
// however, in this implementation, it's easier just
|
|
153
|
-
// to do the intuitive thing, and let brace-expansion
|
|
154
|
-
// actually come before parsing any extglob patterns,
|
|
155
|
-
// like the documentation seems to say.
|
|
156
|
-
//
|
|
157
|
-
// XXX: if anyone complains about this, either fix it
|
|
158
|
-
// or tell them to grow up and stop complaining.
|
|
159
|
-
//
|
|
160
|
-
// bash/bsdglob says this:
|
|
161
|
-
// , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
|
|
162
|
-
// but we do this instead:
|
|
163
|
-
, ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
|
|
164
|
-
|
|
165
|
-
// test partial parsing in the presence of comment/negation chars
|
|
166
|
-
, ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
|
|
167
|
-
, ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
|
|
168
|
-
|
|
169
|
-
// like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
|
|
170
|
-
, ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
|
|
171
|
-
, ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
|
|
172
|
-
, {}
|
|
173
|
-
, ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// crazy nested {,,} and *(||) tests.
|
|
177
|
-
, function () {
|
|
178
|
-
files = [ "a", "b", "c", "d"
|
|
179
|
-
, "ab", "ac", "ad"
|
|
180
|
-
, "bc", "cb"
|
|
181
|
-
, "bc,d", "c,db", "c,d"
|
|
182
|
-
, "d)", "(b|c", "*(b|c"
|
|
183
|
-
, "b|c", "b|cc", "cb|c"
|
|
184
|
-
, "x(a|b|c)", "x(a|c)"
|
|
185
|
-
, "(a|b|c)", "(a|c)"]
|
|
186
|
-
}
|
|
187
|
-
, ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
|
|
188
|
-
, ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
|
|
189
|
-
// a
|
|
190
|
-
// *(b|c)
|
|
191
|
-
// *(b|d)
|
|
192
|
-
, ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
|
|
193
|
-
, ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
// test various flag settings.
|
|
197
|
-
, [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
|
|
198
|
-
, { noext: true } ]
|
|
199
|
-
, ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
|
|
200
|
-
, ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
|
|
201
|
-
, ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
// begin channelling Boole and deMorgan...
|
|
205
|
-
, "negation tests"
|
|
206
|
-
, function () {
|
|
207
|
-
files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// anything that is NOT a* matches.
|
|
211
|
-
, ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
|
|
212
|
-
|
|
213
|
-
// anything that IS !a* matches.
|
|
214
|
-
, ["!a*", ["!ab", "!abc"], {nonegate: true}]
|
|
215
|
-
|
|
216
|
-
// anything that IS a* matches
|
|
217
|
-
, ["!!a*", ["a!b"]]
|
|
218
|
-
|
|
219
|
-
// anything that is NOT !a* matches
|
|
220
|
-
, ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
|
|
221
|
-
|
|
222
|
-
// negation nestled within a pattern
|
|
223
|
-
, function () {
|
|
224
|
-
files = [ "foo.js"
|
|
225
|
-
, "foo.bar"
|
|
226
|
-
// can't match this one without negative lookbehind.
|
|
227
|
-
, "foo.js.js"
|
|
228
|
-
, "blar.js"
|
|
229
|
-
, "foo."
|
|
230
|
-
, "boo.js.boo" ]
|
|
231
|
-
}
|
|
232
|
-
, ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
|
|
233
|
-
|
|
234
|
-
// https://github.com/isaacs/minimatch/issues/5
|
|
235
|
-
, function () {
|
|
236
|
-
files = [ 'a/b/.x/c'
|
|
237
|
-
, 'a/b/.x/c/d'
|
|
238
|
-
, 'a/b/.x/c/d/e'
|
|
239
|
-
, 'a/b/.x'
|
|
240
|
-
, 'a/b/.x/'
|
|
241
|
-
, 'a/.x/b'
|
|
242
|
-
, '.x'
|
|
243
|
-
, '.x/'
|
|
244
|
-
, '.x/a'
|
|
245
|
-
, '.x/a/b'
|
|
246
|
-
, 'a/.x/b/.x/c'
|
|
247
|
-
, '.x/.x' ]
|
|
248
|
-
}
|
|
249
|
-
, ["**/.x/**", [ '.x/'
|
|
250
|
-
, '.x/a'
|
|
251
|
-
, '.x/a/b'
|
|
252
|
-
, 'a/.x/b'
|
|
253
|
-
, 'a/b/.x/'
|
|
254
|
-
, 'a/b/.x/c'
|
|
255
|
-
, 'a/b/.x/c/d'
|
|
256
|
-
, 'a/b/.x/c/d/e' ] ]
|
|
257
|
-
|
|
258
|
-
].forEach(function (c) {
|
|
259
|
-
if (typeof c === "function") return c()
|
|
260
|
-
if (typeof c === "string") return t.comment(c)
|
|
261
|
-
|
|
262
|
-
var pattern = c[0]
|
|
263
|
-
, expect = c[1].sort(alpha)
|
|
264
|
-
, options = c[2] || {}
|
|
265
|
-
, f = c[3] || files
|
|
266
|
-
, tapOpts = c[4] || {}
|
|
267
|
-
|
|
268
|
-
// options.debug = true
|
|
269
|
-
var m = new mm.Minimatch(pattern, options)
|
|
270
|
-
var r = m.makeRe()
|
|
271
|
-
tapOpts.re = String(r) || JSON.stringify(r)
|
|
272
|
-
tapOpts.files = JSON.stringify(f)
|
|
273
|
-
tapOpts.pattern = pattern
|
|
274
|
-
tapOpts.set = m.set
|
|
275
|
-
tapOpts.negated = m.negate
|
|
276
|
-
|
|
277
|
-
var actual = mm.match(f, pattern, options)
|
|
278
|
-
actual.sort(alpha)
|
|
279
|
-
|
|
280
|
-
t.equivalent( actual, expect
|
|
281
|
-
, JSON.stringify(pattern) + " " + JSON.stringify(expect)
|
|
282
|
-
, tapOpts )
|
|
283
|
-
})
|
|
357
|
+
patterns.forEach(function (c) {
|
|
358
|
+
if (typeof c === "function") return c()
|
|
359
|
+
if (typeof c === "string") return t.comment(c)
|
|
360
|
+
|
|
361
|
+
var pattern = c[0]
|
|
362
|
+
, expect = c[1].sort(alpha)
|
|
363
|
+
, options = c[2] || {}
|
|
364
|
+
, f = c[3] || files
|
|
365
|
+
, tapOpts = c[4] || {}
|
|
366
|
+
|
|
367
|
+
// options.debug = true
|
|
368
|
+
var m = new mm.Minimatch(pattern, options)
|
|
369
|
+
var r = m.makeRe()
|
|
370
|
+
var expectRe = regexps[re++]
|
|
371
|
+
tapOpts.re = String(r) || JSON.stringify(r)
|
|
372
|
+
tapOpts.files = JSON.stringify(f)
|
|
373
|
+
tapOpts.pattern = pattern
|
|
374
|
+
tapOpts.set = m.set
|
|
375
|
+
tapOpts.negated = m.negate
|
|
376
|
+
|
|
377
|
+
var actual = mm.match(f, pattern, options)
|
|
378
|
+
actual.sort(alpha)
|
|
379
|
+
|
|
380
|
+
t.equivalent( actual, expect
|
|
381
|
+
, JSON.stringify(pattern) + " " + JSON.stringify(expect)
|
|
382
|
+
, tapOpts )
|
|
383
|
+
|
|
384
|
+
t.equal(tapOpts.re, expectRe, tapOpts)
|
|
385
|
+
})
|
|
284
386
|
|
|
285
387
|
t.comment("time=" + (Date.now() - start) + "ms")
|
|
286
388
|
t.end()
|
package/.travis.yml
DELETED