()
| 639 | #[test] |
| 640 | #[should_panic = "next_value_seed before next_key_seed"] |
| 641 | fn map_incorrect_len_values() { |
| 642 | let mut map = BTreeMap::new(); |
| 643 | map.insert(1u8, 2u8); |
| 644 | let input = crate::serialize(&map).unwrap(); |
| 645 | |
| 646 | let w = super::DecoderWrapper { |
| 647 | decoder: &mut super::SerdeDecoder::Unspecified { length: 1 }, |
| 648 | input: &mut input.as_slice(), |
| 649 | }; |
| 650 | |
| 651 | struct Visitor; |
| 652 | impl<'de> serde::de::Visitor<'de> for Visitor { |
| 653 | type Value = (); |
| 654 | fn expecting(&self, _: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 655 | unreachable!() |
| 656 | } |
| 657 | fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> |
| 658 | where |
| 659 | A: MapAccess<'de>, |
| 660 | { |
| 661 | assert_eq!(map.next_key::<u8>().unwrap().unwrap(), 1u8); |
| 662 | assert_eq!(map.next_value::<u8>().unwrap(), 2u8); |
| 663 | map.next_value::<u8>().unwrap(); |
| 664 | Ok(()) |
| 665 | } |
| 666 | } |
| 667 | w.deserialize_map(Visitor).unwrap(); |
| 668 | } |
| 669 | } |
nothing calls this directly
no test coverage detected