about summary refs log tree commit diff
path: root/tests/nyble_pages.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/nyble_pages.rs')
-rw-r--r--tests/nyble_pages.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/nyble_pages.rs b/tests/nyble_pages.rs
index 14ca1cc..2c99bc2 100644
--- a/tests/nyble_pages.rs
+++ b/tests/nyble_pages.rs
@@ -6,8 +6,30 @@ fn pares_homepage() {
 	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);
+}