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