use mxml_dep::*; #[test] fn fme1() { let mut xml = parse("
a

b

").unwrap(); let m = FindMatchEditElement { fme: vec![( FindElement{find:vec![Find::ChildElement]}, MatchElement{when:vec![Match::HasTag("div".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("class".to_string(),"d".to_string())]} )] }; fme(&mut xml, &m); assert_eq!( unparse(&xml), r#"
a

b

"# ); } #[test] fn fme2() { let mut xml = parse(r#"
a

b

"#).unwrap(); let m = FindMatchEditElement { fme: vec![( FindElement{find:vec![Find::ChildElement]}, MatchElement{when:vec![Match::HasAttribute("id".to_string(),"b".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("class".to_string(),"d".to_string())]} )] }; fme(&mut xml, &m); assert_eq!( unparse(&xml), r#"
a

b

"# ); } #[test] fn fme3() { let mut xml = parse(r#"
a

b

"#).unwrap(); let m = FindMatchEditElement { fme: vec![( FindElement{find:vec![Find::ChildElement]}, MatchElement{when:vec![Match::HasAttribute("class".to_string(),"b".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("class".to_string(),"d".to_string())]} )] }; fme(&mut xml, &m); assert_eq!( unparse(&xml), r#"
a

b

"# ); } #[test] fn fme4() { let mut xml = parse(r#"
a

b

"#).unwrap(); let m = FindMatchEditElement { fme: vec![( FindElement{find:vec![Find::ChildElement]}, MatchElement{when:vec![Match::HasAttribute("b".to_string(),"".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("class".to_string(),"d".to_string())]} )] }; fme(&mut xml, &m); assert_eq!( unparse(&xml), r#"
a

b

"# ); } #[test] fn fme5() { let mut xml = parse(r#"
a

b

"#).unwrap(); let m = FindMatchEditElement { fme: vec![( FindElement{find:vec![Find::ChildElement]}, MatchElement{when:vec![Match::HasAttribute("b".to_string(),"c".to_string())]}, EditElement{edit:vec![Edit::AddAttribute("class".to_string(),"d".to_string())]} )] }; fme(&mut xml, &m); assert_eq!( unparse(&xml), r#"
a

b

"# ); } #[test] fn fme6() { let mut xml = parse(r#"

b

"#).unwrap(); let m = FindMatchEditElement { fme: vec![( FindElement{find:vec![Find::ChildElement]}, MatchElement{when:vec![]}, EditElement{edit:vec![]} ),( FindElement{find:vec![Find::ChildElement]}, MatchElement{when:vec![]}, EditElement{edit:vec![Edit::AddAttribute("class".to_string(),"d".to_string())]} )] }; fme(&mut xml, &m); assert_eq!( unparse(&xml), r#"

b

"# ); }