mirror of
https://github.com/thangisme/notes.git
synced 2026-06-14 20:39:59 -04:00
Initial commit
This commit is contained in:
28
node_modules/yargs/test/count.js
generated
vendored
Normal file
28
node_modules/yargs/test/count.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var should = require('chai').should()
|
||||
yargs = require('../index');
|
||||
|
||||
describe('count', function () {
|
||||
|
||||
it('should count the number of times a boolean is present', function () {
|
||||
var parsed;
|
||||
|
||||
parsed = yargs(['-x']).count('verbose').argv;
|
||||
parsed.verbose.should.equal(0);
|
||||
|
||||
parsed = yargs(['--verbose']).count('verbose').argv;
|
||||
parsed.verbose.should.equal(1);
|
||||
|
||||
parsed = yargs(['--verbose', '--verbose']).count('verbose').argv;
|
||||
parsed.verbose.should.equal(2);
|
||||
|
||||
parsed = yargs(['-vvv']).alias('v', 'verbose').count('verbose').argv;
|
||||
parsed.verbose.should.equal(3);
|
||||
|
||||
parsed = yargs(['--verbose', '--verbose', '-v', '--verbose']).count('verbose').alias('v', 'verbose').argv;
|
||||
parsed.verbose.should.equal(4);
|
||||
|
||||
parsed = yargs(['--verbose', '--verbose', '-v', '-vv']).count('verbose').alias('v', 'verbose').argv;
|
||||
parsed.verbose.should.equal(5);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user