mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-10 13:22:51 -07:00
add absolute file path description for windows (#12007)
This commit is contained in:
@@ -36,6 +36,14 @@ vi.mock('../telemetry/loggers.js', () => ({
|
||||
logFileOperation: vi.fn(),
|
||||
}));
|
||||
|
||||
interface EditFileParameterSchema {
|
||||
properties: {
|
||||
file_path: {
|
||||
description: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
import type { Mock } from 'vitest';
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
||||
import type { EditToolParams } from './edit.js';
|
||||
@@ -1025,6 +1033,38 @@ describe('EditTool', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('constructor', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should use windows-style path examples on windows', () => {
|
||||
vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
|
||||
|
||||
const tool = new EditTool({} as unknown as Config);
|
||||
const schema = tool.schema;
|
||||
expect(
|
||||
(schema.parametersJsonSchema as EditFileParameterSchema).properties
|
||||
.file_path.description,
|
||||
).toBe(
|
||||
"The absolute path to the file to modify (e.g., 'C:\\Users\\project\\file.txt'). Must be an absolute path.",
|
||||
);
|
||||
});
|
||||
|
||||
it('should use unix-style path examples on non-windows platforms', () => {
|
||||
vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
|
||||
|
||||
const tool = new EditTool({} as unknown as Config);
|
||||
const schema = tool.schema;
|
||||
expect(
|
||||
(schema.parametersJsonSchema as EditFileParameterSchema).properties
|
||||
.file_path.description,
|
||||
).toBe(
|
||||
"The absolute path to the file to modify (e.g., '/home/user/project/file.txt'). Must start with '/'.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('IDE mode', () => {
|
||||
const testFile = 'edit_me.txt';
|
||||
let filePath: string;
|
||||
|
||||
Reference in New Issue
Block a user