mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
test: update glob tool test to cover case-insensitive path comparison on macOS
This commit is contained in:
@@ -198,23 +198,33 @@ describe('GlobTool', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find files even if workspace path casing differs from glob results (Windows)', async () => {
|
it('should find files even if workspace path casing differs from glob results (Windows/macOS)', async () => {
|
||||||
// Only relevant for Windows
|
// Only relevant for Windows and macOS
|
||||||
if (process.platform !== 'win32') {
|
if (process.platform !== 'win32' && process.platform !== 'darwin') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Create a path with mismatched casing for the workspace root
|
let mismatchedRootDir = tempRootDir;
|
||||||
// e.g., if tempRootDir is "C:\Users\...", make it "c:\Users\..."
|
|
||||||
const drive = path.parse(tempRootDir).root;
|
|
||||||
if (!drive || !drive.match(/^[A-Z]:\\/)) {
|
|
||||||
// Skip if we can't determine/manipulate the drive letter easily
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lowerDrive = drive.toLowerCase();
|
if (process.platform === 'win32') {
|
||||||
const mismatchedRootDir =
|
// 1. Create a path with mismatched casing for the workspace root
|
||||||
lowerDrive + tempRootDir.substring(drive.length);
|
// e.g., if tempRootDir is "C:\Users\...", make it "c:\Users\..."
|
||||||
|
const drive = path.parse(tempRootDir).root;
|
||||||
|
if (!drive || !drive.match(/^[A-Z]:\\/)) {
|
||||||
|
// Skip if we can't determine/manipulate the drive letter easily
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lowerDrive = drive.toLowerCase();
|
||||||
|
mismatchedRootDir = lowerDrive + tempRootDir.substring(drive.length);
|
||||||
|
} else {
|
||||||
|
// macOS: change the casing of the path
|
||||||
|
if (tempRootDir === tempRootDir.toLowerCase()) {
|
||||||
|
mismatchedRootDir = tempRootDir.toUpperCase();
|
||||||
|
} else {
|
||||||
|
mismatchedRootDir = tempRootDir.toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 2. Create a new GlobTool instance with this mismatched root
|
// 2. Create a new GlobTool instance with this mismatched root
|
||||||
const mismatchedConfig = {
|
const mismatchedConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user