opal 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/lib/opal/cli.rb +9 -1
- data/lib/opal/cli_options.rb +12 -3
- data/lib/opal/cli_runners/nodejs.rb +3 -2
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/kernel.rb +7 -0
- data/opal/corelib/runtime.js +4 -0
- data/spec/lib/cli_spec.rb +16 -0
- data/stdlib/nodejs.rb +1 -2
- data/stdlib/nodejs/{process.rb → kernel.rb} +7 -4
- data/stdlib/nodejs/node_modules/.bin/js-yaml +140 -0
- data/stdlib/nodejs/node_modules/glob/LICENSE +15 -0
- data/stdlib/nodejs/node_modules/glob/README.md +357 -0
- data/stdlib/nodejs/node_modules/glob/common.js +177 -0
- data/stdlib/nodejs/node_modules/glob/glob.js +649 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/README.md +37 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +52 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/package.json +61 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inflight/test.js +97 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inherits/package.json +51 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/README.md +216 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +4 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +4 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/package.json +60 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/LICENSE +27 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/README.md +51 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +52 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/once.js +21 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/package.json +60 -0
- data/stdlib/nodejs/node_modules/glob/node_modules/once/test/once.js +23 -0
- data/stdlib/nodejs/node_modules/glob/package.json +72 -0
- data/stdlib/nodejs/node_modules/glob/sync.js +409 -0
- data/stdlib/nodejs/node_modules/js-yaml/HISTORY.md +277 -0
- data/stdlib/nodejs/node_modules/js-yaml/LICENSE +21 -0
- data/stdlib/nodejs/node_modules/js-yaml/README.md +288 -0
- data/stdlib/nodejs/node_modules/js-yaml/bin/js-yaml.js +140 -0
- data/stdlib/nodejs/node_modules/js-yaml/bower.json +23 -0
- data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.js +3666 -0
- data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.min.js +3 -0
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.js +102 -0
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.yml +18 -0
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.js +31 -0
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.json +22 -0
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.js +18 -0
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.yml +197 -0
- data/stdlib/nodejs/node_modules/js-yaml/index.js +7 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml.js +39 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/common.js +62 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/dumper.js +554 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/exception.js +25 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/loader.js +1581 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/mark.js +78 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema.js +103 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/binary.js +133 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/bool.js +37 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/float.js +110 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/int.js +183 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/function.js +85 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +84 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +27 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/null.js +36 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/omap.js +56 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/pairs.js +61 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/set.js +33 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +98 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/.bin/esparse +117 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/.bin/esvalidate +177 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/HISTORY.md +115 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/LICENSE +21 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +239 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/arguments.js +36 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/choice.js +22 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/constants.js +59 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/help.js +13 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/nargs.js +33 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js +28 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js +23 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js +49 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sum.js +35 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js +270 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/index.js +1 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action.js +146 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append.js +55 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js +47 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/count.js +40 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/help.js +48 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store.js +50 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js +43 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js +27 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js +26 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js +148 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/version.js +50 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action_container.js +481 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argparse.js +14 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js +50 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js +54 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js +75 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js +1168 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/const.js +18 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js +88 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js +798 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/namespace.js +77 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.npmignore +2 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml +8 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown +825 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/bower.json +33 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/component.json +11 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/foo.js +10 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/gulpfile.js +26 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js +673 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log +0 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json +107 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE +23 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md +22 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json +69 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js +6 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js +1415 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/package.json +62 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/README.md +73 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esparse.js +117 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js +177 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/esprima.js +3908 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/package.json +69 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/compat.js +239 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/reflect.js +422 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/run.js +66 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/runner.js +387 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/test.js +20238 -0
- data/stdlib/nodejs/node_modules/js-yaml/package.json +83 -0
- data/{package.json → stdlib/nodejs/package.json} +0 -3
- data/stdlib/phantomjs.rb +1 -6
- data/tasks/testing.rake +1 -4
- metadata +191 -6
- data/stdlib/nodejs/runtime.rb +0 -26
@@ -0,0 +1,45 @@
|
|
1
|
+
var tap = require("tap")
|
2
|
+
, minimatch = require("../")
|
3
|
+
|
4
|
+
tap.test("brace expansion", function (t) {
|
5
|
+
// [ pattern, [expanded] ]
|
6
|
+
; [ [ "a{b,c{d,e},{f,g}h}x{y,z}"
|
7
|
+
, [ "abxy"
|
8
|
+
, "abxz"
|
9
|
+
, "acdxy"
|
10
|
+
, "acdxz"
|
11
|
+
, "acexy"
|
12
|
+
, "acexz"
|
13
|
+
, "afhxy"
|
14
|
+
, "afhxz"
|
15
|
+
, "aghxy"
|
16
|
+
, "aghxz" ] ]
|
17
|
+
, [ "a{1..5}b"
|
18
|
+
, [ "a1b"
|
19
|
+
, "a2b"
|
20
|
+
, "a3b"
|
21
|
+
, "a4b"
|
22
|
+
, "a5b" ] ]
|
23
|
+
, [ "a{b}c", ["a{b}c"] ]
|
24
|
+
, [ "a{00..05}b"
|
25
|
+
, [ "a00b"
|
26
|
+
, "a01b"
|
27
|
+
, "a02b"
|
28
|
+
, "a03b"
|
29
|
+
, "a04b"
|
30
|
+
, "a05b" ] ]
|
31
|
+
, [ "z{a,b},c}d", ["za,c}d", "zb,c}d"] ]
|
32
|
+
, [ "z{a,b{,c}d", ["z{a,bd", "z{a,bcd"] ]
|
33
|
+
, [ "a{b{c{d,e}f}g}h", ["a{b{cdf}g}h", "a{b{cef}g}h"] ]
|
34
|
+
, [ "a{b{c{d,e}f{x,y}}g}h", ["a{b{cdfx}g}h", "a{b{cdfy}g}h", "a{b{cefx}g}h", "a{b{cefy}g}h"] ]
|
35
|
+
, [ "a{b{c{d,e}f{x,y{}g}h", ["a{b{cdfxh", "a{b{cdfy{}gh", "a{b{cefxh", "a{b{cefy{}gh"] ]
|
36
|
+
].forEach(function (tc) {
|
37
|
+
var p = tc[0]
|
38
|
+
, expect = tc[1]
|
39
|
+
t.equivalent(minimatch.braceExpand(p), expect, p)
|
40
|
+
})
|
41
|
+
console.error("ending")
|
42
|
+
t.end()
|
43
|
+
})
|
44
|
+
|
45
|
+
|
@@ -0,0 +1,274 @@
|
|
1
|
+
// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
|
2
|
+
//
|
3
|
+
// TODO: Some of these tests do very bad things with backslashes, and will
|
4
|
+
// most likely fail badly on windows. They should probably be skipped.
|
5
|
+
|
6
|
+
var tap = require("tap")
|
7
|
+
, globalBefore = Object.keys(global)
|
8
|
+
, mm = require("../")
|
9
|
+
, files = [ "a", "b", "c", "d", "abc"
|
10
|
+
, "abd", "abe", "bb", "bcd"
|
11
|
+
, "ca", "cb", "dd", "de"
|
12
|
+
, "bdir/", "bdir/cfile"]
|
13
|
+
, next = files.concat([ "a-b", "aXb"
|
14
|
+
, ".x", ".y" ])
|
15
|
+
|
16
|
+
tap.test("basic tests", function (t) {
|
17
|
+
var start = Date.now()
|
18
|
+
|
19
|
+
// [ pattern, [matches], MM opts, files, TAP opts]
|
20
|
+
; [ "http://www.bashcookbook.com/bashinfo" +
|
21
|
+
"/source/bash-1.14.7/tests/glob-test"
|
22
|
+
, ["a*", ["a", "abc", "abd", "abe"]]
|
23
|
+
, ["X*", ["X*"], {nonull: true}]
|
24
|
+
|
25
|
+
// allow null glob expansion
|
26
|
+
, ["X*", []]
|
27
|
+
|
28
|
+
// isaacs: Slightly different than bash/sh/ksh
|
29
|
+
// \\* is not un-escaped to literal "*" in a failed match,
|
30
|
+
// but it does make it get treated as a literal star
|
31
|
+
, ["\\*", ["\\*"], {nonull: true}]
|
32
|
+
, ["\\**", ["\\**"], {nonull: true}]
|
33
|
+
, ["\\*\\*", ["\\*\\*"], {nonull: true}]
|
34
|
+
|
35
|
+
, ["b*/", ["bdir/"]]
|
36
|
+
, ["c*", ["c", "ca", "cb"]]
|
37
|
+
, ["**", files]
|
38
|
+
|
39
|
+
, ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
|
40
|
+
, ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
|
41
|
+
|
42
|
+
, "legendary larry crashes bashes"
|
43
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
|
44
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
|
45
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
|
46
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
|
47
|
+
|
48
|
+
, "character classes"
|
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
|
+
].forEach(function (c) {
|
235
|
+
if (typeof c === "function") return c()
|
236
|
+
if (typeof c === "string") return t.comment(c)
|
237
|
+
|
238
|
+
var pattern = c[0]
|
239
|
+
, expect = c[1].sort(alpha)
|
240
|
+
, options = c[2]
|
241
|
+
, f = c[3] || files
|
242
|
+
, tapOpts = c[4] || {}
|
243
|
+
|
244
|
+
// options.debug = true
|
245
|
+
var Class = mm.defaults(options).Minimatch
|
246
|
+
var m = new Class(pattern, {})
|
247
|
+
var r = m.makeRe()
|
248
|
+
tapOpts.re = String(r) || JSON.stringify(r)
|
249
|
+
tapOpts.files = JSON.stringify(f)
|
250
|
+
tapOpts.pattern = pattern
|
251
|
+
tapOpts.set = m.set
|
252
|
+
tapOpts.negated = m.negate
|
253
|
+
|
254
|
+
var actual = mm.match(f, pattern, options)
|
255
|
+
actual.sort(alpha)
|
256
|
+
|
257
|
+
t.equivalent( actual, expect
|
258
|
+
, JSON.stringify(pattern) + " " + JSON.stringify(expect)
|
259
|
+
, tapOpts )
|
260
|
+
})
|
261
|
+
|
262
|
+
t.comment("time=" + (Date.now() - start) + "ms")
|
263
|
+
t.end()
|
264
|
+
})
|
265
|
+
|
266
|
+
tap.test("global leak test", function (t) {
|
267
|
+
var globalAfter = Object.keys(global)
|
268
|
+
t.equivalent(globalAfter, globalBefore, "no new globals, please")
|
269
|
+
t.end()
|
270
|
+
})
|
271
|
+
|
272
|
+
function alpha (a, b) {
|
273
|
+
return a > b ? 1 : -1
|
274
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (c) Isaac Z. Schlueter ("Author")
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
The BSD License
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions
|
8
|
+
are met:
|
9
|
+
|
10
|
+
1. Redistributions of source code must retain the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
15
|
+
documentation and/or other materials provided with the distribution.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
18
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
21
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
22
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
24
|
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
25
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
26
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
27
|
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# once
|
2
|
+
|
3
|
+
Only call a function once.
|
4
|
+
|
5
|
+
## usage
|
6
|
+
|
7
|
+
```javascript
|
8
|
+
var once = require('once')
|
9
|
+
|
10
|
+
function load (file, cb) {
|
11
|
+
cb = once(cb)
|
12
|
+
loader.load('file')
|
13
|
+
loader.once('load', cb)
|
14
|
+
loader.once('error', cb)
|
15
|
+
}
|
16
|
+
```
|
17
|
+
|
18
|
+
Or add to the Function.prototype in a responsible way:
|
19
|
+
|
20
|
+
```javascript
|
21
|
+
// only has to be done once
|
22
|
+
require('once').proto()
|
23
|
+
|
24
|
+
function load (file, cb) {
|
25
|
+
cb = cb.once()
|
26
|
+
loader.load('file')
|
27
|
+
loader.once('load', cb)
|
28
|
+
loader.once('error', cb)
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
Ironically, the prototype feature makes this module twice as
|
33
|
+
complicated as necessary.
|
34
|
+
|
35
|
+
To check whether you function has been called, use `fn.called`. Once the
|
36
|
+
function is called for the first time the return value of the original
|
37
|
+
function is saved in `fn.value` and subsequent calls will continue to
|
38
|
+
return this value.
|
39
|
+
|
40
|
+
```javascript
|
41
|
+
var once = require('once')
|
42
|
+
|
43
|
+
function load (cb) {
|
44
|
+
cb = once(cb)
|
45
|
+
var stream = createStream()
|
46
|
+
stream.once('data', cb)
|
47
|
+
stream.once('end', function () {
|
48
|
+
if (!cb.called) cb(new Error('not found'))
|
49
|
+
})
|
50
|
+
}
|
51
|
+
```
|
@@ -0,0 +1,15 @@
|
|
1
|
+
The ISC License
|
2
|
+
|
3
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
4
|
+
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# wrappy
|
2
|
+
|
3
|
+
Callback wrapping utility
|
4
|
+
|
5
|
+
## USAGE
|
6
|
+
|
7
|
+
```javascript
|
8
|
+
var wrappy = require("wrappy")
|
9
|
+
|
10
|
+
// var wrapper = wrappy(wrapperFunction)
|
11
|
+
|
12
|
+
// make sure a cb is called only once
|
13
|
+
// See also: http://npm.im/once for this specific use case
|
14
|
+
var once = wrappy(function (cb) {
|
15
|
+
var called = false
|
16
|
+
return function () {
|
17
|
+
if (called) return
|
18
|
+
called = true
|
19
|
+
return cb.apply(this, arguments)
|
20
|
+
}
|
21
|
+
})
|
22
|
+
|
23
|
+
function printBoo () {
|
24
|
+
console.log('boo')
|
25
|
+
}
|
26
|
+
// has some rando property
|
27
|
+
printBoo.iAmBooPrinter = true
|
28
|
+
|
29
|
+
var onlyPrintOnce = once(printBoo)
|
30
|
+
|
31
|
+
onlyPrintOnce() // prints 'boo'
|
32
|
+
onlyPrintOnce() // does nothing
|
33
|
+
|
34
|
+
// random property is retained!
|
35
|
+
assert.equal(onlyPrintOnce.iAmBooPrinter, true)
|
36
|
+
```
|