Skip to content

Commit b5eb556

Browse files
cola119targos
authored andcommitted
test: add test for short-option followed by its value
PR-URL: #43358 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2b498fe commit b5eb556

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/parallel/test-parse-args.mjs

+8
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ test('handles short-option groups with "short" alias configured', () => {
9191
assert.deepStrictEqual(result, expected);
9292
});
9393

94+
test('handles short-option followed by its value', () => {
95+
const args = ['-fFILE'];
96+
const options = { foo: { short: 'f', type: 'string' } };
97+
const expected = { values: { __proto__: null, foo: 'FILE' }, positionals: [] };
98+
const result = parseArgs({ strict: false, args, options });
99+
assert.deepStrictEqual(result, expected);
100+
});
101+
94102
test('Everything after a bare `--` is considered a positional argument', () => {
95103
const args = ['--', 'barepositionals', 'mopositionals'];
96104
const expected = { values: { __proto__: null }, positionals: ['barepositionals', 'mopositionals'] };

0 commit comments

Comments
 (0)