1var test = require('tape'); 2var parse = require('../'); 3 4test('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 13test('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 22test('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}) 36