1 var parse = require('../');
2 var test = require('tape');
4 test('numeric short args', function (t) {
6 t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });
8 parse([ '-123', '456' ]),
9 { 1: true, 2: true, 3: 456, _: [] }
13 test('short', function (t) {
20 parse([ 'foo', 'bar', 'baz' ]),
21 { _ : [ 'foo', 'bar', 'baz' ] },
26 { c : true, a : true, t : true, s : true, _ : [] },
30 parse([ '-cats', 'meow' ]),
31 { c : true, a : true, t : true, s : 'meow', _ : [] },
35 parse([ '-h', 'localhost' ]),
36 { h : 'localhost', _ : [] },
40 parse([ '-h', 'localhost', '-p', '555' ]),
41 { h : 'localhost', p : 555, _ : [] },
47 test('mixed short bool and capture', function (t) {
49 parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
51 f : true, p : 555, h : 'localhost',
58 test('short and long', function (t) {
60 parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
62 f : true, p : 555, h : 'localhost',