//! Kept in it's own file to more easily import into the Percy book. use crate::diff::diff; use crate::patch::Patch; use virtual_node::VirtualNode; /// Test that we generate the right Vec for some start and end virtual dom. pub struct DiffTestCase<'a> { // ex: "Patching root level nodes works" pub description: &'static str, // ex: html! {
} pub old: VirtualNode, // ex: html! { } pub new: VirtualNode, // ex: vec![Patch::Replace(0, &html! { })], pub expected: Vec>, } impl<'a> DiffTestCase<'a> { pub fn test(&self) { // ex: vec![Patch::Replace(0, &html! { })], let patches = diff(&self.old, &self.new); assert_eq!(patches, self.expected, "{}", self.description); } }