From 0a6a16c175e8944ea5e9e655db27a086cd21efda Mon Sep 17 00:00:00 2001 From: Nylme Date: Wed, 20 Nov 2024 20:13:10 +1100 Subject: [PATCH 1/2] backend/config: Made '[editor|shell].args' optional in config file --- rio-backend/src/config/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rio-backend/src/config/mod.rs b/rio-backend/src/config/mod.rs index 645c1657f1..7a291c2b20 100644 --- a/rio-backend/src/config/mod.rs +++ b/rio-backend/src/config/mod.rs @@ -33,6 +33,7 @@ pub enum ConfigError { #[derive(Default, Debug, Serialize, Deserialize, PartialEq, Clone)] pub struct Shell { pub program: String, + #[serde(default)] pub args: Vec, } @@ -1005,6 +1006,19 @@ mod tests { assert_eq!(result.shell.args, ["--hello"]); } + #[test] + fn test_shell_no_args() { + let result = create_temporary_config( + "change-shell-and-editor", + r#" + shell = { program = "/bin/bash" } + "#, + ); + + assert_eq!(result.shell.program, "/bin/bash"); + assert_eq!(result.shell.args, Vec::<&str>::new()); + } + #[test] fn test_change_developer_and_performance() { let result = create_temporary_config( From 841a36ac7252196ff589e465558be6de7322a56b Mon Sep 17 00:00:00 2001 From: Nylme Date: Wed, 20 Nov 2024 21:08:02 +1100 Subject: [PATCH 2/2] backend/config: '[editor|shell].args' different temp test file --- rio-backend/src/config/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rio-backend/src/config/mod.rs b/rio-backend/src/config/mod.rs index 7a291c2b20..775c967cab 100644 --- a/rio-backend/src/config/mod.rs +++ b/rio-backend/src/config/mod.rs @@ -1009,13 +1009,13 @@ mod tests { #[test] fn test_shell_no_args() { let result = create_temporary_config( - "change-shell-and-editor", + "change-shell-and-editor-no-args", r#" - shell = { program = "/bin/bash" } + shell = { program = "/bin/fish" } "#, ); - assert_eq!(result.shell.program, "/bin/bash"); + assert_eq!(result.shell.program, "/bin/fish"); assert_eq!(result.shell.args, Vec::<&str>::new()); }