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.

31 lines
779 B

8 years ago
  1. var test = require('tape');
  2. var parse = require('../');
  3. test('long opts', function (t) {
  4. t.deepEqual(
  5. parse([ '--bool' ]),
  6. { bool : true, _ : [] },
  7. 'long boolean'
  8. );
  9. t.deepEqual(
  10. parse([ '--pow', 'xixxle' ]),
  11. { pow : 'xixxle', _ : [] },
  12. 'long capture sp'
  13. );
  14. t.deepEqual(
  15. parse([ '--pow=xixxle' ]),
  16. { pow : 'xixxle', _ : [] },
  17. 'long capture eq'
  18. );
  19. t.deepEqual(
  20. parse([ '--host', 'localhost', '--port', '555' ]),
  21. { host : 'localhost', port : 555, _ : [] },
  22. 'long captures sp'
  23. );
  24. t.deepEqual(
  25. parse([ '--host=localhost', '--port=555' ]),
  26. { host : 'localhost', port : 555, _ : [] },
  27. 'long captures eq'
  28. );
  29. t.end();
  30. });