From 2148f2e0bc69b7563358029b7ee8db94aa7720f0 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 14 Apr 2026 08:25:17 +0100 Subject: [PATCH] option_parser: Fix incorrect unit test This unit test was trying to test with extra "="s in the input but was instead testing using an unknown option. Add the option to the parser to not hit that incorrect error. Signed-off-by: Rob Bradford --- option_parser/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/option_parser/src/lib.rs b/option_parser/src/lib.rs index e57cd895e..6be4bcbb1 100644 --- a/option_parser/src/lib.rs +++ b/option_parser/src/lib.rs @@ -588,11 +588,13 @@ mod unit_tests { assert_eq!(split_commas("\"\"").unwrap(), vec!["\"\""]); parser.parse("size=128M,hanging_param").unwrap_err(); - parser - .parse("size=128M,too_many_equals=foo=bar") - .unwrap_err(); parser.parse("size=128M,file=/dev/shm").unwrap_err(); + // Equals signs within a value are fine (splitn(2, '=') keeps them) + parser.add("extra"); + parser.parse("extra=foo=bar").unwrap(); + assert_eq!(parser.get("extra"), Some("foo=bar".to_owned())); + parser.parse("size=128M").unwrap(); assert_eq!(parser.get("size"), Some("128M".to_owned())); assert!(!parser.is_set("mergeable"));