Skip to content

Commit

Permalink
Add failing test for short aliased booleans.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderarity authored and James Halliday committed Apr 30, 2012
1 parent a075078 commit b9f7b61
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,30 @@ test('boolean and alias with options hash', function (t) {

t.end();
});

test('boolean and alias using explicit true', function (t) {
var aliased = [ '-h', 'true' ];
var regular = [ '--herp', 'true' ];
var opts = {
herp: { alias: 'h', boolean: true }
};
var aliasedArgv = optimist(aliased)
.boolean('h')
.alias('h', 'herp')
.argv;
var propertyArgv = optimist(regular)
.boolean('h')
.alias('h', 'herp')
.argv;
var expected = {
herp: true,
h: true,
'_': [ ],
'$0': expresso,
};

t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});

0 comments on commit b9f7b61

Please sign in to comment.