Integrate open files as tabs into tests

macos-click-through
MultisampledNight 3 years ago
parent fcbb2722f1
commit e2e4f5a744
No known key found for this signature in database
GPG Key ID: 02B1BAF6A675FF9B

@ -160,7 +160,7 @@ pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
let files_to_open: Vec<String> = matches let files_to_open: Vec<String> = matches
.values_of("files_to_open") .values_of("files_to_open")
.map(|opt| opt.map(|v| v.to_owned()).collect()) .map(|opt| opt.map(String::from).collect())
.unwrap_or_default(); .unwrap_or_default();
if files_to_open.len() > 1 if files_to_open.len() > 1
@ -260,16 +260,23 @@ mod tests {
handle_command_line_arguments(args).expect("Could not parse arguments"); handle_command_line_arguments(args).expect("Could not parse arguments");
assert_eq!( assert_eq!(
SETTINGS.get::<CmdLineSettings>().neovim_args, SETTINGS.get::<CmdLineSettings>().neovim_args,
vec!["./foo.txt", "./bar.md"] vec!["-p", "./foo.txt", "./bar.md"]
); );
} }
#[test] #[test]
fn test_files_to_open_with_passthrough() { fn test_files_to_open_with_passthrough() {
let args: Vec<String> = vec!["neovide", "./foo.txt", "./bar.md", "--", "--clean"] let args: Vec<String> = vec![
.iter() "neovide",
.map(|s| s.to_string()) "--notabs",
.collect(); "./foo.txt",
"./bar.md",
"--",
"--clean",
]
.iter()
.map(|s| s.to_string())
.collect();
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap(); let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
handle_command_line_arguments(args).expect("Could not parse arguments"); handle_command_line_arguments(args).expect("Could not parse arguments");
@ -281,10 +288,16 @@ mod tests {
#[test] #[test]
fn test_files_to_open_with_flag() { fn test_files_to_open_with_flag() {
let args: Vec<String> = vec!["neovide", "./foo.txt", "./bar.md", "--geometry=42x24"] let args: Vec<String> = vec![
.iter() "neovide",
.map(|s| s.to_string()) "--notabs",
.collect(); "./foo.txt",
"./bar.md",
"--geometry=42x24",
]
.iter()
.map(|s| s.to_string())
.collect();
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap(); let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
handle_command_line_arguments(args).expect("Could not parse arguments"); handle_command_line_arguments(args).expect("Could not parse arguments");

Loading…
Cancel
Save