import lib // Snapshot tests: compare full XML output against golden strings // Snapshot: simple HTML page fn test_snapshot_html_page(): Unit with {Test} = { let page = lib.el("html", [ lib.el("head", [lib.textEl("title", "Test")]), lib.el("body", [lib.textEl("p", "Hello")]) ]) let expected = "
Hello
" Test.assertEqualMsg(expected, lib.render(page), "snap: HTML page") } // Snapshot: self-closing tags fn test_snapshot_self_closing(): Unit with {Test} = { let node = lib.el("head", [ lib.selfClosing("meta", [lib.attr("charset", "utf-8")]), lib.selfClosing("link", [lib.attr("rel", "stylesheet"), lib.attr("href", "/css/main.css")]) ]) let expected = "" Test.assertEqualMsg(expected, lib.render(node), "snap: self-closing tags") } // Snapshot: XML document with declaration fn test_snapshot_xml_document(): Unit with {Test} = { let root = lib.el("config", [ lib.textEl("name", "MyApp"), lib.textEl("version", "1.0") ]) let expected = "\n