From 393417fe55fe56d30be8418c79a8d37312d1061a Mon Sep 17 00:00:00 2001 From: YardenCuriel Date: Wed, 25 Feb 2026 15:03:12 +0200 Subject: [PATCH 1/2] test: add edge case for config values containing '=' --- src/config.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/config.rs b/src/config.rs index eadbae1..f0e1d9a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -172,4 +172,18 @@ mod tests { fn test_update_config_file_nonexistent_file() { update_config_file("/nonexistent/path/file.cfg", &[("KEY", "value")]); } + + #[test] + fn test_update_config_file_value_contains_equals() { + let tmpfile = NamedTempFile::new().unwrap(); + let path = tmpfile.path().to_str().unwrap(); + + // Values with '=' in them (e.g. base64 encoded) should be preserved + fs::write(path, "TOKEN=abc=def==\n").unwrap(); + + update_config_file(path, &[("TOKEN", "xyz=123==")]); + + let content = fs::read_to_string(path).unwrap(); + assert!(content.contains("TOKEN=xyz=123==")); + } } From df9aa3879b3d65e98b9f7fcf12e4a85ea2f93fae Mon Sep 17 00:00:00 2001 From: yardencuriel Date: Tue, 26 May 2026 19:20:41 +0300 Subject: [PATCH 2/2] Address Copilot review feedback - Fix grammar: hyphenate 'base64-encoded' - Strengthen test assertion to verify exact file content instead of just substring presence --- src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index f0e1d9a..5480a55 100644 --- a/src/config.rs +++ b/src/config.rs @@ -178,12 +178,12 @@ mod tests { let tmpfile = NamedTempFile::new().unwrap(); let path = tmpfile.path().to_str().unwrap(); - // Values with '=' in them (e.g. base64 encoded) should be preserved + // Values with '=' in them (e.g. base64-encoded) should be preserved fs::write(path, "TOKEN=abc=def==\n").unwrap(); update_config_file(path, &[("TOKEN", "xyz=123==")]); let content = fs::read_to_string(path).unwrap(); - assert!(content.contains("TOKEN=xyz=123==")); + assert_eq!(content, "TOKEN=xyz=123==\n"); } }