MCPcopy Create free account
hub / github.com/bootc-dev/bootc / test_remove

Function test_remove

crates/kernel_cmdline/src/bytes.rs:969–985  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

967
968 #[test]
969 fn test_remove() {
970 let mut kargs = Cmdline::from(b"foo bar baz");
971
972 // remove existing
973 assert!(kargs.remove(&"bar".into()));
974 let mut iter = kargs.iter();
975 assert_eq!(iter.next(), Some(param("foo")));
976 assert_eq!(iter.next(), Some(param("baz")));
977 assert_eq!(iter.next(), None);
978
979 // doesn't exist? returns false and doesn't modify anything
980 assert!(!kargs.remove(&"missing".into()));
981 iter = kargs.iter();
982 assert_eq!(iter.next(), Some(param("foo")));
983 assert_eq!(iter.next(), Some(param("baz")));
984 assert_eq!(iter.next(), None);
985 }
986
987 #[test]
988 fn test_remove_duplicates() {

Callers

nothing calls this directly

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected