mirror of
https://github.com/instructkr/claw-code.git
synced 2026-11-19 00:00:00 +08:00
test(runtime): gate the Windows extended-path boundary test to Windows
accepts_equivalent_extended_path_at_workspace_boundary builds its paths with backslash separators. Backslashes only separate path components on Windows, so on Linux each path is a single component, the boundary check rejects the path, and cargo test fails. Run the test only on Windows, and call validate_workspace_boundary through super:: so non-Windows test builds do not warn about an unused import.
This commit is contained in:
1 parent
9e7fd601a5
commit
dbf5389729
1 file changed
+5
-3
@@ -800,8 +800,8 @@ mod tests {
|
|||||||
use super::{
|
use super::{
|
||||||
component_contains_glob, derive_glob_walk_root, edit_file, expand_braces, glob_search,
|
component_contains_glob, derive_glob_walk_root, edit_file, expand_braces, glob_search,
|
||||||
grep_search, is_symlink_escape, normalize_for_comparison, read_file,
|
grep_search, is_symlink_escape, normalize_for_comparison, read_file,
|
||||||
read_file_in_workspace, validate_workspace_boundary, write_file, write_file_in_workspace,
|
read_file_in_workspace, write_file, write_file_in_workspace, GrepSearchInput,
|
||||||
GrepSearchInput, MAX_WRITE_SIZE,
|
MAX_WRITE_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn temp_path(name: &str) -> std::path::PathBuf {
|
fn temp_path(name: &str) -> std::path::PathBuf {
|
||||||
@@ -948,11 +948,13 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Backslash-separated paths only parse into path components on Windows.
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(windows)]
|
||||||
fn accepts_equivalent_extended_path_at_workspace_boundary() {
|
fn accepts_equivalent_extended_path_at_workspace_boundary() {
|
||||||
let root = PathBuf::from(r"C:\workspace");
|
let root = PathBuf::from(r"C:\workspace");
|
||||||
let resolved = PathBuf::from(r"\\?\C:\workspace\src\main.rs");
|
let resolved = PathBuf::from(r"\\?\C:\workspace\src\main.rs");
|
||||||
validate_workspace_boundary(&resolved, &root)
|
super::validate_workspace_boundary(&resolved, &root)
|
||||||
.expect("equivalent Windows path representations should be accepted");
|
.expect("equivalent Windows path representations should be accepted");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user