Skip to content

Commit

Permalink
Refactor --- test into separate plan
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Jan 10, 2023
1 parent c6fd977 commit 36dc85d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/dash.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ var parse = require('../');
var test = require('tape');

test('-', function (t) {
t.plan(8);
t.plan(6);
t.deepEqual(parse(['-n', '-']), { n: '-', _: [] });
t.deepEqual(parse(['--nnn', '-']), { nnn: '-', _: [] });
t.deepEqual(parse(['-n', '---']), { n: '---', _: [] });
t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] });
t.deepEqual(parse(['-']), { _: ['-'] });
t.deepEqual(parse(['-f-']), { f: '-', _: [] });
t.deepEqual(
Expand All @@ -34,3 +32,12 @@ test('move arguments after the -- into their own `--` array', function (t) {
{ name: 'John', _: ['before'], '--': ['after'] }
);
});

test('--- option value', function (t) {
// A multi-dash value is largely an edge case, but check the behaviour is as expected,
// and in particular the same for short option and long option (as made consistent in Jan 2023).
t.plan(2);
t.deepEqual(parse(['-n', '---']), { n: '---', _: [] });
t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] });
});

0 comments on commit 36dc85d

Please sign in to comment.