short.js 640 B

1234567891011121314151617181920
  1. var should = require('chai').should(),
  2. yargs = require('../');
  3. describe('short options', function () {
  4. it ('should set n to the numeric value 123', function () {
  5. var argv = yargs.parse([ '-n123' ]);
  6. should.exist(argv);
  7. argv.should.have.property('n', 123);
  8. });
  9. it ('should set option "1" to true, option "2" to true, and option "3" to numeric value 456', function () {
  10. var argv = yargs.parse([ '-123', '456' ]);
  11. should.exist(argv);
  12. argv.should.have.property('1', true);
  13. argv.should.have.property('2', true);
  14. argv.should.have.property('3', 456);
  15. });
  16. });