Sha256: 80016347834374732f152e8a89bc96084e05d1f1cad8457c287be432a327cd11

Contents?: true

Size: 909 Bytes

Versions: 75

Compression:

Stored size: 909 Bytes

Contents

var test = require('tape');
var expand = require('..');
var fs = require('fs');
var resfile = __dirname + '/bash-results.txt';
var cases = fs.readFileSync(resfile, 'utf8').split('><><><><');

// throw away the EOF marker
cases.pop()

test('matches bash expansions', function(t) {
  cases.forEach(function(testcase) {
    var set = testcase.split('\n');
    var pattern = set.shift();
    var actual = expand(pattern);

    // If it expands to the empty string, then it's actually
    // just nothing, but Bash is a singly typed language, so
    // "nothing" is the same as "".
    if (set.length === 1 && set[0] === '') {
      set = []
    } else {
      // otherwise, strip off the [] that were added so that
      // "" expansions would be preserved properly.
      set = set.map(function (s) {
        return s.replace(/^\[|\]$/g, '')
      })
    }

    t.same(actual, set, pattern);
  });
  t.end();
})

Version data entries

75 entries across 63 versions & 7 rubygems

Version Path
opal-0.11.4 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.11.3 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.11.2 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.11.1 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.11.1.pre stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.6 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.6.beta stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.11.0 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.5 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.4 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.11.0.rc1 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.3 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.2 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.1 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.0 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.0.rc2 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.9.4 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.9.3 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.0.rc1 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
opal-0.10.0.beta5 stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js