MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / test_toggle

Function test_toggle

option_parser/src/lib.rs:728–745  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

726
727 #[test]
728 fn test_toggle() {
729 for (input, expected) in [
730 ("on", true),
731 ("off", false),
732 ("true", true),
733 ("false", false),
734 ("ON", true),
735 ("OFF", false),
736 ("True", true),
737 ("False", false),
738 ] {
739 let mut parser = OptionParser::new();
740 parser.add("flag");
741 parser.parse(&format!("flag={input}")).unwrap();
742 let toggle = parser.convert::<Toggle>("flag").unwrap().unwrap();
743 assert_eq!(toggle.0, expected, "Toggle({input}) should be {expected}");
744 }
745 }
746
747 #[test]
748 fn test_toggle_invalid() {

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
addMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected