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.

32 lines
756 B

8 years ago
  1. var parse = require('../');
  2. var test = require('tape');
  3. test('flag boolean true (default all --args to boolean)', function (t) {
  4. var argv = parse(['moo', '--honk', 'cow'], {
  5. boolean: true
  6. });
  7. t.deepEqual(argv, {
  8. honk: true,
  9. _: ['moo', 'cow']
  10. });
  11. t.deepEqual(typeof argv.honk, 'boolean');
  12. t.end();
  13. });
  14. test('flag boolean true only affects double hyphen arguments without equals signs', function (t) {
  15. var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], {
  16. boolean: true
  17. });
  18. t.deepEqual(argv, {
  19. honk: true,
  20. tacos: 'good',
  21. p: 55,
  22. _: ['moo', 'cow']
  23. });
  24. t.deepEqual(typeof argv.honk, 'boolean');
  25. t.end();
  26. });