1 var test = require('tape');
2 var expand = require('..');
3 var fs = require('fs');
4 var resfile = __dirname + '/bash-results.txt';
5 var cases = fs.readFileSync(resfile, 'utf8').split('><><><><');
7 // throw away the EOF marker
10 test('matches bash expansions', function(t) {
11 cases.forEach(function(testcase) {
12 var set = testcase.split('\n');
13 var pattern = set.shift();
14 var actual = expand(pattern);
16 // If it expands to the empty string, then it's actually
17 // just nothing, but Bash is a singly typed language, so
18 // "nothing" is the same as "".
19 if (set.length === 1 && set[0] === '') {
22 // otherwise, strip off the [] that were added so that
23 // "" expansions would be preserved properly.
24 set = set.map(function (s) {
25 return s.replace(/^\[|\]$/g, '')
29 t.same(actual, set, pattern);