use hygg_shared::normalize_file_path;
use std::fs::File;
use std::io::Write;
#[test]
fn test_basic_path_formats() {
let temp_dir = tempfile::TempDir::new().unwrap();
let original_dir = std::env::current_dir().unwrap();
std::env::set_current_dir(temp_dir.path()).unwrap();
File::create("test.csv").unwrap().write_all(b"data").unwrap();
File::create("Nærri\\ lýsing\\ av\\ gjalding_flyting\\ \\(1\\).csv")
.unwrap()
.write_all(b"data")
.unwrap();
let result = normalize_file_path("./test.csv");
assert!(result.is_ok(), "Forward slash path should work: {:?}", result.err());
let result = normalize_file_path(".\\test.csv");
if cfg!(windows) {
assert!(
result.is_ok(),
"Backslash should work on Windows: {:?}",
result.err()
);
} else {
assert!(
result.is_err(),
"Backslash should fail on Unix (literal character)"
);
}
let result =
normalize_file_path("Nærri\\ lýsing\\ av\\ gjalding_flyting\\ \\(1\\).csv");
assert!(result.is_ok(), "Path with spaces should work: {:?}", result.err());
std::env::set_current_dir(original_dir).unwrap();
}