source: trip-planner-front/node_modules/minimist/test/dash.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 980 bytes
Line 
1var parse = require('../');
2var test = require('tape');
3
4test('-', function (t) {
5 t.plan(5);
6 t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
7 t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
8 t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
9 t.deepEqual(
10 parse([ '-b', '-' ], { boolean: 'b' }),
11 { b: true, _: [ '-' ] }
12 );
13 t.deepEqual(
14 parse([ '-s', '-' ], { string: 's' }),
15 { s: '-', _: [] }
16 );
17});
18
19test('-a -- b', function (t) {
20 t.plan(3);
21 t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
22 t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
23 t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
24});
25
26test('move arguments after the -- into their own `--` array', function(t) {
27 t.plan(1);
28 t.deepEqual(
29 parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
30 { name: 'John', _: [ 'before' ], '--': [ 'after' ] });
31});
Note: See TracBrowser for help on using the repository browser.