react / wstein / node_modules / browserify / node_modules / subarg / node_modules / minimist / test / short.js
80540 viewsvar parse = require('../');1var test = require('tape');23test('numeric short args', function (t) {4t.plan(2);5t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });6t.deepEqual(7parse([ '-123', '456' ]),8{ 1: true, 2: true, 3: 456, _: [] }9);10});1112test('short', function (t) {13t.deepEqual(14parse([ '-b' ]),15{ b : true, _ : [] },16'short boolean'17);18t.deepEqual(19parse([ 'foo', 'bar', 'baz' ]),20{ _ : [ 'foo', 'bar', 'baz' ] },21'bare'22);23t.deepEqual(24parse([ '-cats' ]),25{ c : true, a : true, t : true, s : true, _ : [] },26'group'27);28t.deepEqual(29parse([ '-cats', 'meow' ]),30{ c : true, a : true, t : true, s : 'meow', _ : [] },31'short group next'32);33t.deepEqual(34parse([ '-h', 'localhost' ]),35{ h : 'localhost', _ : [] },36'short capture'37);38t.deepEqual(39parse([ '-h', 'localhost', '-p', '555' ]),40{ h : 'localhost', p : 555, _ : [] },41'short captures'42);43t.end();44});4546test('mixed short bool and capture', function (t) {47t.same(48parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),49{50f : true, p : 555, h : 'localhost',51_ : [ 'script.js' ]52}53);54t.end();55});5657test('short and long', function (t) {58t.deepEqual(59parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),60{61f : true, p : 555, h : 'localhost',62_ : [ 'script.js' ]63}64);65t.end();66});676869