From e2e4f5a74477692596c36d31bd19ba841c12f870 Mon Sep 17 00:00:00 2001 From: MultisampledNight Date: Sat, 30 Apr 2022 16:29:24 +0200 Subject: [PATCH] Integrate open files as tabs into tests --- src/cmd_line.rs | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/cmd_line.rs b/src/cmd_line.rs index ab6814f..c91ac00 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -160,7 +160,7 @@ pub fn handle_command_line_arguments(args: Vec) -> Result<(), String> { let files_to_open: Vec = matches .values_of("files_to_open") - .map(|opt| opt.map(|v| v.to_owned()).collect()) + .map(|opt| opt.map(String::from).collect()) .unwrap_or_default(); if files_to_open.len() > 1 @@ -260,16 +260,23 @@ mod tests { handle_command_line_arguments(args).expect("Could not parse arguments"); assert_eq!( SETTINGS.get::().neovim_args, - vec!["./foo.txt", "./bar.md"] + vec!["-p", "./foo.txt", "./bar.md"] ); } #[test] fn test_files_to_open_with_passthrough() { - let args: Vec = vec!["neovide", "./foo.txt", "./bar.md", "--", "--clean"] - .iter() - .map(|s| s.to_string()) - .collect(); + let args: Vec = vec![ + "neovide", + "--notabs", + "./foo.txt", + "./bar.md", + "--", + "--clean", + ] + .iter() + .map(|s| s.to_string()) + .collect(); let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap(); handle_command_line_arguments(args).expect("Could not parse arguments"); @@ -281,10 +288,16 @@ mod tests { #[test] fn test_files_to_open_with_flag() { - let args: Vec = vec!["neovide", "./foo.txt", "./bar.md", "--geometry=42x24"] - .iter() - .map(|s| s.to_string()) - .collect(); + let args: Vec = vec![ + "neovide", + "--notabs", + "./foo.txt", + "./bar.md", + "--geometry=42x24", + ] + .iter() + .map(|s| s.to_string()) + .collect(); let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap(); handle_command_line_arguments(args).expect("Could not parse arguments");