use cutie::Html; #[test] fn pares_homepage() { let str = std::fs::read_to_string("tests/nyble.html").unwrap(); let html = Html::parse(&str); } fn test_roundtrip(raw: &str) { let html = Html::parse(raw); let string = html.to_string(); for (ln, (raw, round)) in raw.lines().zip(string.lines()).enumerate() { if raw != round { panic!("line {ln} differs!\n\traw: {raw}\n\ttrip: {round}") } } } #[test] fn homepage_roundtrip() { let str = std::fs::read_to_string("tests/nyble.html").unwrap(); test_roundtrip(&str); } #[test] fn parses_grass() { let str = std::fs::read_to_string("tests/touching_grass.html").unwrap(); let html = Html::parse(&str); } #[test] fn grass_roundtrip() { let str = std::fs::read_to_string("tests/touching_grass.html").unwrap(); test_roundtrip(&str); }