Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dylni committed Jul 28, 2024
1 parent c16e087 commit 95871a8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,40 @@ fn test_edge_cases() {
// test!(r"/??/X:", SAME, r"\??\X:");
}

#[test]
fn test_short() {
#[track_caller]
fn test(short_path: &str, long_path: &str) {
let short_path = Path::new(short_path);
let long_path = Path::new(long_path);
common::assert_eq(long_path, short_path.normalize());
assert_ne!(
long_path,
short_path
.normalize_virtually()
.expect("failed to normalize existing path"),
);
}

test(r"C:\DOCUME~1", r"C:\Documents and Settings");
test(r"C:\PROGRA~1", r"C:\Program Files");
test(r"C:\PROGRA~2", r"C:\Program Files (x86)");
}

#[test]
fn test_existing() {
#[track_caller]
fn test(path: &str) {
let path = Path::new(path);
assert!(path.metadata().is_ok());
common::assert_eq(path, path.normalize());
}

test(r"C:\Documents and Settings");
test(r"\\localhost\C$\Documents and Settings");
test(r"\\?\C:\Documents and Settings");
}

// https://github.com/dylni/normpath/issues/5
#[test]
fn test_windows_bug() -> io::Result<()> {
Expand Down

0 comments on commit 95871a8

Please sign in to comment.