mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 08:31:14 -07:00
fix windows escaping (and broken tests) (#19011)
This commit is contained in:
committed by
GitHub
parent
c7237f0c79
commit
e7e4c68c5c
@@ -1023,7 +1023,7 @@ describe('useTextBuffer', () => {
|
||||
useTextBuffer({ viewport, escapePastedPaths: true }),
|
||||
);
|
||||
act(() => result.current.insert(filePath, { paste: true }));
|
||||
expect(getBufferState(result).text).toBe(`@${filePath} `);
|
||||
expect(getBufferState(result).text).toBe(`@${escapePath(filePath)} `);
|
||||
});
|
||||
|
||||
it('should not prepend @ to an invalid file path on insert', () => {
|
||||
@@ -1042,7 +1042,7 @@ describe('useTextBuffer', () => {
|
||||
);
|
||||
const quotedPath = `'${filePath}'`;
|
||||
act(() => result.current.insert(quotedPath, { paste: true }));
|
||||
expect(getBufferState(result).text).toBe(`@${filePath} `);
|
||||
expect(getBufferState(result).text).toBe(`@${escapePath(filePath)} `);
|
||||
});
|
||||
|
||||
it('should not prepend @ to short text that is not a path', () => {
|
||||
@@ -1063,9 +1063,11 @@ describe('useTextBuffer', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useTextBuffer({ viewport, escapePastedPaths: true }),
|
||||
);
|
||||
const filePaths = `${file1} ${file2}`;
|
||||
const filePaths = `${escapePath(file1)} ${escapePath(file2)}`;
|
||||
act(() => result.current.insert(filePaths, { paste: true }));
|
||||
expect(getBufferState(result).text).toBe(`@${file1} @${file2} `);
|
||||
expect(getBufferState(result).text).toBe(
|
||||
`@${escapePath(file1)} @${escapePath(file2)} `,
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle multiple paths with escaped spaces', () => {
|
||||
@@ -1077,13 +1079,12 @@ describe('useTextBuffer', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useTextBuffer({ viewport, escapePastedPaths: true }),
|
||||
);
|
||||
// Construct escaped path string: "/path/to/my\ file.txt /path/to/other.txt"
|
||||
|
||||
const filePaths = `${escapePath(file1)} ${file2}`;
|
||||
const filePaths = `${escapePath(file1)} ${escapePath(file2)}`;
|
||||
|
||||
act(() => result.current.insert(filePaths, { paste: true }));
|
||||
expect(getBufferState(result).text).toBe(
|
||||
`@${escapePath(file1)} @${file2} `,
|
||||
`@${escapePath(file1)} @${escapePath(file2)} `,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user