1 use super::make_command_line;
2 use crate::ffi::{OsStr, OsString};
5 fn test_make_command_line() {
6 fn test_wrapper(prog: &str, args: &[&str]) -> String {
7 let command_line = &make_command_line(
9 &args.iter().map(|a| OsString::from(a)).collect::<Vec<OsString>>(),
12 String::from_utf16(command_line).unwrap()
15 assert_eq!(test_wrapper("prog", &["aaa", "bbb", "ccc"]), "\"prog\" aaa bbb ccc");
18 test_wrapper("C:\\Program Files\\blah\\blah.exe", &["aaa"]),
19 "\"C:\\Program Files\\blah\\blah.exe\" aaa"
22 test_wrapper("C:\\Program Files\\test", &["aa\"bb"]),
23 "\"C:\\Program Files\\test\" aa\\\"bb"
25 assert_eq!(test_wrapper("echo", &["a b c"]), "\"echo\" \"a b c\"");
26 assert_eq!(test_wrapper("echo", &["\" \\\" \\", "\\"]), "\"echo\" \"\\\" \\\\\\\" \\\\\" \\");
28 test_wrapper("\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}", &[]),
29 "\"\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}\""