mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
test(bootstrap-installer): cover PowerShell path layout cross-platform
Make `powershell_under_root` visible under `cfg(test)` so the %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe layout is asserted on any host (the rest of the resolution is gated to Windows).
This commit is contained in:
parent
8720023e96
commit
5dee40fcc0
1 changed files with 13 additions and 1 deletions
|
|
@ -202,7 +202,9 @@ fn build_command(script_path: &Path, args: &[String]) -> Command {
|
|||
}
|
||||
|
||||
/// Canonical PowerShell 5.1 location under a Windows root (`%SystemRoot%`).
|
||||
#[cfg(target_os = "windows")]
|
||||
/// Kept separate (and test-visible) so the path layout is unit-tested on any
|
||||
/// host, not just Windows.
|
||||
#[cfg(any(target_os = "windows", test))]
|
||||
fn powershell_under_root(root: &Path) -> std::path::PathBuf {
|
||||
root.join("System32")
|
||||
.join("WindowsPowerShell")
|
||||
|
|
@ -342,4 +344,14 @@ info line
|
|||
let cwd = stable_script_cwd(script, Some("/"));
|
||||
assert_eq!(cwd, Some(Path::new("/")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn powershell_under_root_uses_system32_v1_layout() {
|
||||
let resolved = powershell_under_root(Path::new("C:\\Windows"));
|
||||
let normalized = resolved.to_string_lossy().replace('\\', "/");
|
||||
assert!(
|
||||
normalized.ends_with("System32/WindowsPowerShell/v1.0/powershell.exe"),
|
||||
"unexpected powershell path: {normalized}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue