[6a3a178] | 1 | var test = require('tape'),
|
---|
| 2 | wildcard = require('../'),
|
---|
| 3 | testdata = [
|
---|
| 4 | 'a.b.c',
|
---|
| 5 | 'a.b',
|
---|
| 6 | 'a',
|
---|
| 7 | 'a.b.d'
|
---|
| 8 | ],
|
---|
| 9 | testdataSep = [
|
---|
| 10 | 'a:b:c',
|
---|
| 11 | 'a:b',
|
---|
| 12 | 'a',
|
---|
| 13 | 'a:b:d'
|
---|
| 14 | ];
|
---|
| 15 |
|
---|
| 16 | test('array result matching tests', function(t) {
|
---|
| 17 | t.plan(5);
|
---|
| 18 |
|
---|
| 19 | t.equal(wildcard('*', testdata).length, 4, '* matches all testdata');
|
---|
| 20 | t.equal(wildcard('a.*', testdata).length, 4, '4 matches found');
|
---|
| 21 | t.equal(wildcard('a.b.*', testdata).length, 3, '3 matches found');
|
---|
| 22 | t.equal(wildcard('a.*.c', testdata).length, 1);
|
---|
| 23 | t.equal(wildcard('b.*.d', testdata).length, 0);
|
---|
| 24 | });
|
---|
| 25 |
|
---|
| 26 | test('array result with separator matching tests', function(t) {
|
---|
| 27 | t.plan(4);
|
---|
| 28 |
|
---|
| 29 | t.equal(wildcard('a:*', testdataSep, ':').length, 4, '4 matches found');
|
---|
| 30 | t.equal(wildcard('a:b:*', testdataSep, ':').length, 3, '3 matches found');
|
---|
| 31 | t.equal(wildcard('a:*:c', testdataSep, ':').length, 1);
|
---|
| 32 | t.equal(wildcard('b:*:d', testdataSep, ':').length, 0);
|
---|
| 33 | });
|
---|