| 1014 | |
| 1015 | #[test] |
| 1016 | fn test_extend() { |
| 1017 | let mut kargs = Cmdline::from(b"foo=bar baz"); |
| 1018 | let other = Cmdline::from(b"qux=quux foo=updated"); |
| 1019 | |
| 1020 | kargs.extend(&other); |
| 1021 | |
| 1022 | // Sanity check that the lifetimes of the two Cmdlines are not |
| 1023 | // tied to each other. |
| 1024 | drop(other); |
| 1025 | |
| 1026 | // Should have preserved the original foo, added qux, baz |
| 1027 | // unchanged, and added the second (duplicate key) foo |
| 1028 | let mut iter = kargs.iter(); |
| 1029 | assert_eq!(iter.next(), Some(param("foo=bar"))); |
| 1030 | assert_eq!(iter.next(), Some(param("baz"))); |
| 1031 | assert_eq!(iter.next(), Some(param("qux=quux"))); |
| 1032 | assert_eq!(iter.next(), Some(param("foo=updated"))); |
| 1033 | assert_eq!(iter.next(), None); |
| 1034 | } |
| 1035 | |
| 1036 | #[test] |
| 1037 | fn test_extend_empty() { |