From 5425a310f4d4a3297b0aedbef52d6e8f2460c1ab Mon Sep 17 00:00:00 2001 From: cola119 Date: Thu, 9 Jun 2022 18:45:14 +0900 Subject: [PATCH] test: add test for short-option followed by its value --- test/parallel/test-parse-args.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/parallel/test-parse-args.mjs b/test/parallel/test-parse-args.mjs index 602ab1fc97ea4b..ef0ac006282bd7 100644 --- a/test/parallel/test-parse-args.mjs +++ b/test/parallel/test-parse-args.mjs @@ -91,6 +91,14 @@ test('handles short-option groups with "short" alias configured', () => { assert.deepStrictEqual(result, expected); }); +test('handles short-option followed by its value', () => { + const args = ['-fFILE']; + const options = { foo: { short: 'f', type: 'string' } }; + const expected = { values: { __proto__: null, foo: 'FILE' }, positionals: [] }; + const result = parseArgs({ strict: false, args, options }); + assert.deepStrictEqual(result, expected); +}); + test('Everything after a bare `--` is considered a positional argument', () => { const args = ['--', 'barepositionals', 'mopositionals']; const expected = { values: { __proto__: null }, positionals: ['barepositionals', 'mopositionals'] };