You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
588 B

7 years ago
  1. var parse = require('../');
  2. var test = require('tape');
  3. test('dotted alias', function (t) {
  4. var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
  5. t.equal(argv.a.b, 22);
  6. t.equal(argv.aa.bb, 22);
  7. t.end();
  8. });
  9. test('dotted default', function (t) {
  10. var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
  11. t.equal(argv.a.b, 11);
  12. t.equal(argv.aa.bb, 11);
  13. t.end();
  14. });
  15. test('dotted default with no alias', function (t) {
  16. var argv = parse('', {default: {'a.b': 11}});
  17. t.equal(argv.a.b, 11);
  18. t.end();
  19. });