Skip to content

Commit 9963753

Browse files
Copilotchenrui333
andcommitted
test(util): add comprehensive edge case coverage for brace expansion parsing
Co-authored-by: chenrui333 <[email protected]>
1 parent c619af7 commit 9963753

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

__tests__/util.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,36 @@ describe('util', () => {
444444
});
445445
});
446446
});
447+
448+
describe('parseInputFiles edge cases', () => {
449+
it('handles multiple brace groups on same line', () => {
450+
assert.deepStrictEqual(parseInputFiles('./**/*.{exe,deb},./dist/**/*.{zip,tar.gz}'), [
451+
'./**/*.{exe,deb}',
452+
'./dist/**/*.{zip,tar.gz}',
453+
]);
454+
});
455+
456+
it('handles nested braces', () => {
457+
assert.deepStrictEqual(parseInputFiles('path/{a,{b,c}}/file.txt'), ['path/{a,{b,c}}/file.txt']);
458+
});
459+
460+
it('handles empty comma-separated values', () => {
461+
assert.deepStrictEqual(parseInputFiles('foo,,bar'), ['foo', 'bar']);
462+
});
463+
464+
it('handles commas with spaces around braces', () => {
465+
assert.deepStrictEqual(parseInputFiles(' ./**/*.{exe,deb} , file.txt '), [
466+
'./**/*.{exe,deb}',
467+
'file.txt',
468+
]);
469+
});
470+
471+
it('handles mixed newlines and commas with braces', () => {
472+
assert.deepStrictEqual(parseInputFiles('file1.txt\n./**/*.{exe,deb},file2.txt\nfile3.txt'), [
473+
'file1.txt',
474+
'./**/*.{exe,deb}',
475+
'file2.txt',
476+
'file3.txt',
477+
]);
478+
});
479+
});

0 commit comments

Comments
 (0)