From 9963753aeb936c3a36f64fb86ee98e551c1298aa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 03:21:37 +0000 Subject: [PATCH] test(util): add comprehensive edge case coverage for brace expansion parsing Co-authored-by: chenrui333 <1580956+chenrui333@users.noreply.github.com> --- __tests__/util.test.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/__tests__/util.test.ts b/__tests__/util.test.ts index bbb4df8..ab4fdd2 100644 --- a/__tests__/util.test.ts +++ b/__tests__/util.test.ts @@ -444,3 +444,36 @@ describe('util', () => { }); }); }); + +describe('parseInputFiles edge cases', () => { + it('handles multiple brace groups on same line', () => { + assert.deepStrictEqual(parseInputFiles('./**/*.{exe,deb},./dist/**/*.{zip,tar.gz}'), [ + './**/*.{exe,deb}', + './dist/**/*.{zip,tar.gz}', + ]); + }); + + it('handles nested braces', () => { + assert.deepStrictEqual(parseInputFiles('path/{a,{b,c}}/file.txt'), ['path/{a,{b,c}}/file.txt']); + }); + + it('handles empty comma-separated values', () => { + assert.deepStrictEqual(parseInputFiles('foo,,bar'), ['foo', 'bar']); + }); + + it('handles commas with spaces around braces', () => { + assert.deepStrictEqual(parseInputFiles(' ./**/*.{exe,deb} , file.txt '), [ + './**/*.{exe,deb}', + 'file.txt', + ]); + }); + + it('handles mixed newlines and commas with braces', () => { + assert.deepStrictEqual(parseInputFiles('file1.txt\n./**/*.{exe,deb},file2.txt\nfile3.txt'), [ + 'file1.txt', + './**/*.{exe,deb}', + 'file2.txt', + 'file3.txt', + ]); + }); +});