diff options
Diffstat (limited to 'deps/npm/node_modules/glob/test/mark.js')
-rw-r--r-- | deps/npm/node_modules/glob/test/mark.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/deps/npm/node_modules/glob/test/mark.js b/deps/npm/node_modules/glob/test/mark.js index ed68a335c..bf411c0e5 100644 --- a/deps/npm/node_modules/glob/test/mark.js +++ b/deps/npm/node_modules/glob/test/mark.js @@ -2,6 +2,42 @@ var test = require("tap").test var glob = require('../') process.chdir(__dirname) +// expose timing issues +var lag = 5 +glob.Glob.prototype._stat = function(o) { return function(f, cb) { + var args = arguments + setTimeout(function() { + o.call(this, f, cb) + }.bind(this), lag += 5) +}}(glob.Glob.prototype._stat) + + +test("mark, with **", function (t) { + glob("a/*b*/**", {mark: true}, function (er, results) { + if (er) + throw er + var expect = + [ 'a/abcdef/', + 'a/abcdef/g/', + 'a/abcdef/g/h', + 'a/abcfed/', + 'a/abcfed/g/', + 'a/abcfed/g/h', + 'a/b/', + 'a/b/c/', + 'a/b/c/d', + 'a/bc/', + 'a/bc/e/', + 'a/bc/e/f', + 'a/cb/', + 'a/cb/e/', + 'a/cb/e/f' ] + + t.same(results, expect) + t.end() + }) +}) + test("mark, no / on pattern", function (t) { glob("a/*", {mark: true}, function (er, results) { if (er) @@ -18,6 +54,8 @@ test("mark, no / on pattern", function (t) { t.same(results, expect) t.end() + }).on('match', function(m) { + t.similar(m, /\/$/) }) }) @@ -36,6 +74,8 @@ test("mark=false, no / on pattern", function (t) { expect.push('a/symlink') t.same(results, expect) t.end() + }).on('match', function(m) { + t.similar(m, /[^\/]$/) }) }) @@ -53,6 +93,8 @@ test("mark=true, / on pattern", function (t) { expect.push('a/symlink/') t.same(results, expect) t.end() + }).on('match', function(m) { + t.similar(m, /\/$/) }) }) @@ -70,5 +112,7 @@ test("mark=false, / on pattern", function (t) { expect.push('a/symlink/') t.same(results, expect) t.end() + }).on('match', function(m) { + t.similar(m, /\/$/) }) }) |