Skip to content

Commit 01cb9b4

Browse files
committed
test: update process_output_filename tests for Windows path handling
1 parent 48908f3 commit 01cb9b4

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/options.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,32 +352,33 @@ mod tests {
352352
);
353353

354354
// Windows-style paths (treated robustly across platforms)
355+
// Use a drive-letter form to align with Windows path semantics.
355356
// On Windows, backslash is a separator and Path::join will normalize it.
356357
// On non-Windows, backslash is a normal char, so the string stays as-is.
357-
let input_win_style_with_dot = "C\\\\dir\\\\file.";
358+
let input_win_style_with_dot = "C:\\dir\\file.";
358359
let expected_win_style_with_dot = if cfg!(windows) {
359-
std::path::Path::new("C\\dir").join("file.gpscan").to_string_lossy().into_owned()
360+
std::path::Path::new("C:\\dir").join("file.gpscan").to_string_lossy().into_owned()
360361
} else {
361-
"C\\\\dir\\\\file.gpscan".to_string()
362+
"C:\\dir\\file.gpscan".to_string()
362363
};
363364
assert_eq!(
364365
Options::process_output_filename(input_win_style_with_dot),
365366
expected_win_style_with_dot
366367
);
367368
assert_eq!(
368-
Options::process_output_filename("C\\\\dir\\\\"),
369-
"C\\\\dir\\\\"
369+
Options::process_output_filename("C:\\dir\\"),
370+
"C:\\dir\\"
370371
);
371-
let input_win_style = "C\\\\dir\\\\file";
372+
let input_win_style = "C:\\dir\\file";
372373
let expected_win_style = if cfg!(windows) {
373-
std::path::Path::new("C\\dir").join("file.gpscan").to_string_lossy().into_owned()
374+
std::path::Path::new("C:\\dir").join("file.gpscan").to_string_lossy().into_owned()
374375
} else {
375-
"C\\\\dir\\\\file.gpscan".to_string()
376+
"C:\\dir\\file.gpscan".to_string()
376377
};
377378
assert_eq!(Options::process_output_filename(input_win_style), expected_win_style);
378379
assert_eq!(
379-
Options::process_output_filename("C\\\\dir\\\\file.gpscan"),
380-
"C\\\\dir\\\\file.gpscan"
380+
Options::process_output_filename("C:\\dir\\file.gpscan"),
381+
"C:\\dir\\file.gpscan"
381382
);
382383
}
383384
}

0 commit comments

Comments
 (0)