test.js 795 B

12345678910111213141516171819202122
  1. 'use strict';
  2. var gp = require('./');
  3. var assert = require('assert');
  4. describe('glob-parent', function() {
  5. it('should strip glob magic to return parent path', function() {
  6. assert.equal(gp('path/to/*.js'), 'path/to');
  7. assert.equal(gp('/root/path/to/*.js'), '/root/path/to');
  8. assert.equal(gp('/*.js'), '/');
  9. assert.equal(gp('*.js'), '.');
  10. assert.equal(gp('**/*.js'), '.');
  11. assert.equal(gp('path/{to,from}'), 'path');
  12. assert.equal(gp('path/!(to|from)'), 'path');
  13. assert.equal(gp('path/?(to|from)'), 'path');
  14. assert.equal(gp('path/+(to|from)'), 'path');
  15. assert.equal(gp('path/*(to|from)'), 'path');
  16. assert.equal(gp('path/@(to|from)'), 'path');
  17. assert.equal(gp('path/**/*'), 'path');
  18. assert.equal(gp('path/**/subdir/foo.*'), 'path');
  19. });
  20. });