mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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 <rbradford@meta.com>
This commit is contained in:
@@ -588,11 +588,13 @@ mod unit_tests {
|
|||||||
|
|
||||||
assert_eq!(split_commas("\"\"").unwrap(), vec!["\"\""]);
|
assert_eq!(split_commas("\"\"").unwrap(), vec!["\"\""]);
|
||||||
parser.parse("size=128M,hanging_param").unwrap_err();
|
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();
|
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();
|
parser.parse("size=128M").unwrap();
|
||||||
assert_eq!(parser.get("size"), Some("128M".to_owned()));
|
assert_eq!(parser.get("size"), Some("128M".to_owned()));
|
||||||
assert!(!parser.is_set("mergeable"));
|
assert!(!parser.is_set("mergeable"));
|
||||||
|
|||||||
Reference in New Issue
Block a user