Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
756 bytes
|
Line | |
---|
1 | var parse = require('../');
|
---|
2 | var test = require('tape');
|
---|
3 |
|
---|
4 | test('flag boolean true (default all --args to boolean)', function (t) {
|
---|
5 | var argv = parse(['moo', '--honk', 'cow'], {
|
---|
6 | boolean: true
|
---|
7 | });
|
---|
8 |
|
---|
9 | t.deepEqual(argv, {
|
---|
10 | honk: true,
|
---|
11 | _: ['moo', 'cow']
|
---|
12 | });
|
---|
13 |
|
---|
14 | t.deepEqual(typeof argv.honk, 'boolean');
|
---|
15 | t.end();
|
---|
16 | });
|
---|
17 |
|
---|
18 | test('flag boolean true only affects double hyphen arguments without equals signs', function (t) {
|
---|
19 | var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], {
|
---|
20 | boolean: true
|
---|
21 | });
|
---|
22 |
|
---|
23 | t.deepEqual(argv, {
|
---|
24 | honk: true,
|
---|
25 | tacos: 'good',
|
---|
26 | p: 55,
|
---|
27 | _: ['moo', 'cow']
|
---|
28 | });
|
---|
29 |
|
---|
30 | t.deepEqual(typeof argv.honk, 'boolean');
|
---|
31 | t.end();
|
---|
32 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.