Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add failing test for short aliased booleans.

  • Loading branch information...
commit b9f7b613b1e68e11e6c23fbda9e555a517dcc976 1 parent a075078
@coderarity coderarity authored committed
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/parse.js
View
27 test/parse.js
@@ -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();
+});
+
Please sign in to comment.
Something went wrong with that request. Please try again.