From 284a015bf8127dcf9a592a825774fa2796d5b72b Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 24 Nov 2022 21:27:22 -0800 Subject: [PATCH] Remove Vec tests from entities --- instant-xml/tests/entities.rs | 40 +++++------------------------------ 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/instant-xml/tests/entities.rs b/instant-xml/tests/entities.rs index 5345098..91c57f6 100644 --- a/instant-xml/tests/entities.rs +++ b/instant-xml/tests/entities.rs @@ -10,61 +10,32 @@ struct StructSpecialEntities<'a> { string: String, str: &'a str, cow: Cow<'a, str>, - vec: Vec, -} - -#[derive(Debug, PartialEq, Eq, FromXml, ToXml)] -#[xml(ns("URI"))] -struct VecEntities<'a> { - complex: Vec>, - list1: Vec, - list2: Vec>, -} - -#[test] -fn vec_entities() { - let serialized = r#"<>&"'adsad"strstr&onetwothreeabab"#; - - let instance = VecEntities { - complex: vec![StructSpecialEntities { - string: String::from("<>&\"'adsad\""), - str: "str", - cow: Cow::Owned("str&".to_string()), - vec: vec!["one".into(), "two".into(), "three".into()], - }], - list1: vec!["a".into(), "b".into()], - list2: vec![vec!["a".into(), "b".into()]], - }; - - assert_eq!(to_string(&instance).unwrap(), serialized); - assert_eq!(from_str(serialized), Ok(instance)); } #[test] fn escape_back() { assert_eq!( from_str( - "<>&"'adsad"strstr&onetwothree" + "<>&"'adsad"strstr&" ), Ok(StructSpecialEntities { string: String::from("<>&\"'adsad\""), str: "str", cow: Cow::Owned("str&".to_string()), - vec: vec!["one".into(), "two".into(), "three".into()] }) ); // Wrong str char assert_eq!( from_str( - "<>&"'adsad"str&onetwothree" + "<>&"'adsad"str&" ), Err::(Error::UnexpectedValue) ); // Borrowed let escape_back = from_str::( - "<>&"'adsad"strstronetwothree" + "<>&"'adsad"strstr" ) .unwrap(); @@ -74,7 +45,7 @@ fn escape_back() { // Owned let escape_back = from_str::( - "<>&"'adsad"strstr&onetwothree" + "<>&"'adsad"strstr&" ) .unwrap(); @@ -90,8 +61,7 @@ fn special_entities() { string: "&\"<>\'aa".to_string(), str: "&\"<>\'bb", cow: Cow::from("&\"<>\'cc"), - vec: vec!["one".into(), "two".into(), "three".into()] }).unwrap(), - "&"<>'aa&"<>'bb&"<>'cconetwothree", + "&"<>'aa&"<>'bb&"<>'cc", ); }