dash.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. var should = require('chai').should(),
  2. yargs = require('../index');
  3. describe('-', function () {
  4. it('should set - as value of n', function () {
  5. var argv = yargs.parse(['-n', '-']);
  6. argv.should.have.property('n', '-');
  7. argv.should.have.property('_').with.length(0);
  8. });
  9. it('should set - as a non-hyphenated value', function () {
  10. var argv = yargs.parse(['-']);
  11. argv.should.have.property('_').and.deep.equal(['-']);
  12. });
  13. it('should set - as a value of f', function () {
  14. var argv = yargs.parse(['-f-']);
  15. argv.should.have.property('f', '-');
  16. argv.should.have.property('_').with.length(0);
  17. });
  18. it('should set b to true and set - as a non-hyphenated value when b is set as a boolean', function () {
  19. var argv = yargs(['-b', '-']).boolean('b').argv;
  20. argv.should.have.property('b', true);
  21. argv.should.have.property('_').and.deep.equal(['-']);
  22. });
  23. it('should set - as the value of s when s is set as a string', function () {
  24. var argv = yargs([ '-s', '-' ]).string('s').argv;
  25. argv.should.have.property('s', '-');
  26. argv.should.have.property('_').with.length(0);
  27. });
  28. });