Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior with brace expansion #1

Closed
rovjuvano opened this issue Feb 5, 2014 · 2 comments
Closed

Behavior with brace expansion #1

rovjuvano opened this issue Feb 5, 2014 · 2 comments

Comments

@rovjuvano
Copy link

4 tests, the two with brace expansion fail

  it('should get a base name from character class pattern', function(done) {
    var globber = new glob.Glob("js/t[a-z]st}/*.js", {cwd: __dirname});
    glob2base(globber).should.equal("js/");
    done();
  });
  // passes

  it('should get a base name from brace , expansion', function(done) {
    var globber = new glob.Glob("js/{src,test}/*.js", {cwd: __dirname});
    glob2base(globber).should.equal("js/");
    done();
  });
  // AssertionError: expected 'js/src/' to be 'js/

  it.only('should get a base name from brace .. expansion', function(done) {
    var globber = new glob.Glob("js/test{0..9}/*.js", {cwd: __dirname});
    glob2base(globber).should.equal("js/");
    done();
  });
  // AssertionError: expected 'js/test0/' to be 'js/'

  it('should get a base name from extglob', function(done) {
    var globber = new glob.Glob("js/t+(wo|est)/*.js", {cwd: __dirname});
    glob2base(globber).should.equal("js/");
    done();
  });
  // passes

The behavior when involving brace expansion:

  1. Does not conform to the behavior with other types of patterns (it includes instead of excludes the directory matched). This can be argued as the correct behavior.
  2. Only produces a base for the first expansion and not any of the subsequent ones in the pattern. Due to this behavior, modules such as glob-stream will produce Files with a path outside the base. (e.g. path: CWD/test/main.js, base: CWD/src/)
@yocontra
Copy link
Owner

yocontra commented Feb 5, 2014

The base in all of those examples should be js/ - Will look into this tonight

@yocontra
Copy link
Owner

yocontra commented Feb 5, 2014

Fixed in 0.0.5 - an npm update should fix this right up. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants