|
|
@ -181,8 +181,8 @@ pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
mod tests {
|
|
|
|
use std::sync::Mutex;
|
|
|
|
|
|
|
|
use std::env::set_var;
|
|
|
|
use std::env::set_var;
|
|
|
|
|
|
|
|
use std::sync::Mutex;
|
|
|
|
|
|
|
|
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
|
|
|
|
|
|
|
@ -195,41 +195,43 @@ mod tests {
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_neovim_passthrough() {
|
|
|
|
fn test_neovim_passthrough() {
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
let args: Vec<String> = vec!["neovide", "--", "--clean"]
|
|
|
|
"neovide",
|
|
|
|
.iter()
|
|
|
|
"--",
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
"--clean",
|
|
|
|
.collect();
|
|
|
|
].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");
|
|
|
|
assert_eq!(SETTINGS.get::<CmdLineSettings>().neovim_args, vec!["--clean"]);
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
SETTINGS.get::<CmdLineSettings>().neovim_args,
|
|
|
|
|
|
|
|
vec!["--clean"]
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_geometry() {
|
|
|
|
fn test_geometry() {
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
let args: Vec<String> = vec!["neovide", "--geometry=42x24"]
|
|
|
|
"neovide",
|
|
|
|
.iter()
|
|
|
|
"--geometry=42x24",
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
].iter()
|
|
|
|
.collect();
|
|
|
|
.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");
|
|
|
|
assert_eq!(SETTINGS.get::<CmdLineSettings>().geometry, Dimensions { width: 42, height: 24 });
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
SETTINGS.get::<CmdLineSettings>().geometry,
|
|
|
|
|
|
|
|
Dimensions {
|
|
|
|
|
|
|
|
width: 42,
|
|
|
|
|
|
|
|
height: 24
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_log_to_file() {
|
|
|
|
fn test_log_to_file() {
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
let args: Vec<String> = vec!["neovide", "--log"]
|
|
|
|
"neovide",
|
|
|
|
.iter()
|
|
|
|
"--log",
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
].iter()
|
|
|
|
.collect();
|
|
|
|
.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");
|
|
|
@ -238,12 +240,10 @@ mod tests {
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_frameless_flag() {
|
|
|
|
fn test_frameless_flag() {
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
let args: Vec<String> = vec!["neovide", "--frameless"]
|
|
|
|
"neovide",
|
|
|
|
.iter()
|
|
|
|
"--frameless",
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
].iter()
|
|
|
|
.collect();
|
|
|
|
.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");
|
|
|
@ -252,11 +252,7 @@ mod tests {
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_frameless_environment_variable() {
|
|
|
|
fn test_frameless_environment_variable() {
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
let args: Vec<String> = vec!["neovide"].iter().map(|s| s.to_string()).collect();
|
|
|
|
"neovide",
|
|
|
|
|
|
|
|
].iter()
|
|
|
|
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
|
|
|
|
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
|
|
|
|
set_var("NEOVIDE_FRAMELESS", "true");
|
|
|
|
set_var("NEOVIDE_FRAMELESS", "true");
|
|
|
@ -266,30 +262,29 @@ mod tests {
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_neovim_bin_arg() {
|
|
|
|
fn test_neovim_bin_arg() {
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
let args: Vec<String> = vec!["neovide", "--neovim-bin", "foo"]
|
|
|
|
"neovide",
|
|
|
|
.iter()
|
|
|
|
"--neovim-bin",
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
"foo",
|
|
|
|
.collect();
|
|
|
|
].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");
|
|
|
|
assert_eq!(SETTINGS.get::<CmdLineSettings>().neovim_bin, Some("foo".to_owned()));
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
SETTINGS.get::<CmdLineSettings>().neovim_bin,
|
|
|
|
|
|
|
|
Some("foo".to_owned())
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_neovim_bin_environment_variable() {
|
|
|
|
fn test_neovim_bin_environment_variable() {
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
let args: Vec<String> = vec!["neovide"].iter().map(|s| s.to_string()).collect();
|
|
|
|
"neovide",
|
|
|
|
|
|
|
|
].iter()
|
|
|
|
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
|
|
|
|
let _accessing_settings = ACCESSING_SETTINGS.lock().unwrap();
|
|
|
|
set_var("NEOVIM_BIN", "foo");
|
|
|
|
set_var("NEOVIM_BIN", "foo");
|
|
|
|
handle_command_line_arguments(args).expect("Could not parse arguments");
|
|
|
|
handle_command_line_arguments(args).expect("Could not parse arguments");
|
|
|
|
assert_eq!(SETTINGS.get::<CmdLineSettings>().neovim_bin, Some("foo".to_owned()));
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
SETTINGS.get::<CmdLineSettings>().neovim_bin,
|
|
|
|
|
|
|
|
Some("foo".to_owned())
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|