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

Function test_extend

crates/kernel_cmdline/src/utf8.rs:890–908  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

888
889 #[test]
890 fn test_extend() {
891 let mut kargs = Cmdline::from("foo=bar baz");
892 let other = Cmdline::from("qux=quux foo=updated");
893
894 kargs.extend(&other);
895
896 // Sanity check that the lifetimes of the two Cmdlines are not
897 // tied to each other.
898 drop(other);
899
900 // Should have preserved the original foo, added qux, baz
901 // unchanged, and added the second (duplicate key) foo
902 let mut iter = kargs.iter();
903 assert_eq!(iter.next(), Some(param("foo=bar")));
904 assert_eq!(iter.next(), Some(param("baz")));
905 assert_eq!(iter.next(), Some(param("qux=quux")));
906 assert_eq!(iter.next(), Some(param("foo=updated")));
907 assert_eq!(iter.next(), None);
908 }
909
910 #[test]
911 fn test_extend_empty() {

Callers

nothing calls this directly

Calls 2

extendMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected