mirror of
https://github.com/openai/codex.git
synced 2026-09-17 12:23:33 +00:00
Add windows + single quote tests
This commit is contained in:
@@ -56,6 +56,21 @@ mod tests {
|
||||
assert_eq!(result, PathBuf::from("/home/user/My File.png"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalize_single_quoted_unix_path() {
|
||||
let input = "'/home/user/My File.png'";
|
||||
let result = normalize_pasted_path(input).expect("should trim single quotes via shlex");
|
||||
assert_eq!(result, PathBuf::from("/home/user/My File.png"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn normalize_single_quoted_windows_path() {
|
||||
let input = r"'C:\Users\Alice\My File.jpeg'";
|
||||
let result =
|
||||
normalize_pasted_path(input).expect("should trim single quotes on windows path");
|
||||
assert_eq!(result, PathBuf::from(r"C:\Users\Alice\My File.jpeg"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn img_format_label_png_jpeg_unknown() {
|
||||
assert_eq!(get_img_format_label(PathBuf::from("/a/b/c.PNG")), "PNG");
|
||||
@@ -64,4 +79,14 @@ mod tests {
|
||||
assert_eq!(get_img_format_label(PathBuf::from("/a/b/c")), "IMG");
|
||||
assert_eq!(get_img_format_label(PathBuf::from("/a/b/c.webp")), "IMG");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn img_format_label_with_windows_style_paths() {
|
||||
assert_eq!(get_img_format_label(PathBuf::from(r"C:\a\b\c.PNG")), "PNG");
|
||||
assert_eq!(
|
||||
get_img_format_label(PathBuf::from(r"C:\a\b\c.jpeg")),
|
||||
"JPEG"
|
||||
);
|
||||
assert_eq!(get_img_format_label(PathBuf::from(r"C:\a\b\noext")), "IMG");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user