use mxml_dep::*; #[test] fn mixin1() { let xml = "

a

b

c

"; let m1 = FindMatchEditElement { fme: vec![( FindElement{find:vec![]}, MatchElement{when:vec![Match::HasTag("p".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("a".to_string(),"".to_string())]} ),( FindElement{find:vec![]}, MatchElement{when:vec![Match::HasTag("p".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("b".to_string(),"".to_string())]} )] }; let m2 = FindMatchEditElement { fme: vec![( FindElement{find:vec![]}, MatchElement{when:vec![Match::HasAttribute("b".to_string(),"".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("c".to_string(),"".to_string())]} )] }; let m = m1.then(m2); let xml = m.mixin(xml); assert_eq!( xml, r#"

a

b

c

"# ); } #[test] fn mixin2() { let xml = "

a

b

c

"; let m1 = FindMatchEditElement { fme: vec![( FindElement{find:vec![]}, MatchElement{when:vec![Match::HasTag("p".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("a".to_string(),"".to_string())]} ),( FindElement{find:vec![]}, MatchElement{when:vec![Match::HasTag("p".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("b".to_string(),"".to_string())]} )] }; let m2 = FindMatchEditElement { fme: vec![( FindElement{find:vec![]}, MatchElement{when:vec![Match::HasAttribute("b".to_string(),"".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("c".to_string(),"".to_string())]} )] }; let m3 = FindMatchEditElement { fme: vec![( FindElement{find:vec![]}, MatchElement{when:vec![Match::HasAttribute("c".to_string(),"".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("d".to_string(),"".to_string())]} )] }; let m = m1.then(m2).then(m3); let xml = m.mixin(xml); assert_eq!( xml, r#"

a

b

c

"# ); }