Skip to content

Commit 452fd27

Browse files
authored
test: add env var path coverage (#422)
Summary: - Add coverage for WindowsApps path component matching in `pet-env-var-path`. - Verify matching is case-insensitive by component and rejects partial component names. - Covers a small utility-crate slice from the #389 coverage plan. Validation: - cargo test -p pet-env-var-path - cargo fmt --all - cargo clippy --all -- -D warnings Refs #389
1 parent 07f390c commit 452fd27

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

  • crates/pet-env-var-path/src

crates/pet-env-var-path/src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,26 @@ mod tests {
163163
vec![normalize_search_path(PathBuf::from("/usr/bin"))]
164164
);
165165
}
166+
167+
#[test]
168+
fn windows_apps_path_detection_is_case_insensitive_by_components() {
169+
let path = PathBuf::from(if cfg!(windows) {
170+
r"C:\Users\User\appdata\LOCAL\microsoft\WINDOWSAPPS"
171+
} else {
172+
"/Users/user/appdata/LOCAL/microsoft/WINDOWSAPPS"
173+
});
174+
175+
assert!(is_windows_apps_path(&path, None));
176+
}
177+
178+
#[test]
179+
fn windows_apps_path_detection_rejects_partial_component_matches() {
180+
let path = PathBuf::from(if cfg!(windows) {
181+
r"C:\Users\User\AppDataBackup\Local\Microsoft\WindowsApps"
182+
} else {
183+
"/Users/user/AppDataBackup/Local/Microsoft/WindowsApps"
184+
});
185+
186+
assert!(!is_windows_apps_path(&path, None));
187+
}
166188
}

0 commit comments

Comments
 (0)