| 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() { |