Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
778 bytes
|
Line | |
---|
1 | var test = require('tape');
|
---|
2 | var parse = require('../');
|
---|
3 |
|
---|
4 | test('boolean default true', function (t) {
|
---|
5 | var argv = parse([], {
|
---|
6 | boolean: 'sometrue',
|
---|
7 | default: { sometrue: true }
|
---|
8 | });
|
---|
9 | t.equal(argv.sometrue, true);
|
---|
10 | t.end();
|
---|
11 | });
|
---|
12 |
|
---|
13 | test('boolean default false', function (t) {
|
---|
14 | var argv = parse([], {
|
---|
15 | boolean: 'somefalse',
|
---|
16 | default: { somefalse: false }
|
---|
17 | });
|
---|
18 | t.equal(argv.somefalse, false);
|
---|
19 | t.end();
|
---|
20 | });
|
---|
21 |
|
---|
22 | test('boolean default to null', function (t) {
|
---|
23 | var argv = parse([], {
|
---|
24 | boolean: 'maybe',
|
---|
25 | default: { maybe: null }
|
---|
26 | });
|
---|
27 | t.equal(argv.maybe, null);
|
---|
28 | var argv = parse(['--maybe'], {
|
---|
29 | boolean: 'maybe',
|
---|
30 | default: { maybe: null }
|
---|
31 | });
|
---|
32 | t.equal(argv.maybe, true);
|
---|
33 | t.end();
|
---|
34 |
|
---|
35 | })
|
---|
Note:
See
TracBrowser
for help on using the repository browser.