diff options
| author | Niladri Das <[email protected]> | 2025-07-31 22:06:50 +0530 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-31 16:36:50 +0000 |
| commit | 9a6422f331294ea2f56d67599ed142d09cc33320 (patch) | |
| tree | 16f3e58fc1ce3b6de88082dd4bb194a6635bafac /scripts | |
| parent | ae86c7ba05567264ca2d115a7f96d887bc576457 (diff) | |
fix: CLAUDE.md compatibility for GEMINI.md '@' file import behavior (#2978)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Allen Hutchison <[email protected]>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/test-windows-paths.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/test-windows-paths.js b/scripts/test-windows-paths.js new file mode 100644 index 00000000..d25d29c2 --- /dev/null +++ b/scripts/test-windows-paths.js @@ -0,0 +1,51 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import path from 'path'; +import { fileURLToPath } from 'url'; + +// Test how paths are normalized +function testPathNormalization() { + // Use platform-agnostic path construction instead of hardcoded paths + const testPath = path.join('test', 'project', 'src', 'file.md'); + const absoluteTestPath = path.resolve('test', 'project', 'src', 'file.md'); + + console.log('Testing path normalization:'); + console.log('Relative path:', testPath); + console.log('Absolute path:', absoluteTestPath); + + // Test path.join with different segments + const joinedPath = path.join('test', 'project', 'src', 'file.md'); + console.log('Joined path:', joinedPath); + + // Test path.normalize + console.log('Normalized relative path:', path.normalize(testPath)); + console.log('Normalized absolute path:', path.normalize(absoluteTestPath)); + + // Test how the test would see these paths + const testContent = `--- File: ${absoluteTestPath} ---\nContent\n--- End of File: ${absoluteTestPath} ---`; + console.log('\nTest content with platform-agnostic paths:'); + console.log(testContent); + + // Try to match with different patterns + const marker = `--- File: ${absoluteTestPath} ---`; + console.log('\nTrying to match:', marker); + console.log('Direct match:', testContent.includes(marker)); + + // Test with normalized path in marker + const normalizedMarker = `--- File: ${path.normalize(absoluteTestPath)} ---`; + console.log( + 'Normalized marker match:', + testContent.includes(normalizedMarker), + ); + + // Test path resolution + const __filename = fileURLToPath(import.meta.url); + console.log('\nCurrent file path:', __filename); + console.log('Directory name:', path.dirname(__filename)); +} + +testPathNormalization(); |
