From e4c316f2ccda33f8f56e0dc93100a53d94046346 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Wed, 28 May 2025 22:19:41 +0800 Subject: [PATCH] Add tests --- tests/suite/loading/html.typ | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/suite/loading/html.typ diff --git a/tests/suite/loading/html.typ b/tests/suite/loading/html.typ new file mode 100644 index 000000000..783c4c67f --- /dev/null +++ b/tests/suite/loading/html.typ @@ -0,0 +1,46 @@ +--- html --- +// Test reading XML data. +#let data = html-decode("/assets/text/example.html") +#test(data, (( + tag: "html", + attrs: (:), + children: ( + ( + tag: "head", + attrs: (:), + children: ( + "\n ", + ( + tag: "meta", + attrs: (charset: "UTF-8"), + children: (), + ), + "\n ", + ( + tag: "title", + attrs: (:), + children: ("Example document",), + ), + "\n ", + ), + ), + "\n ", + ( + tag: "body", + attrs: (:), + children: ( + "\n ", + ( + tag: "h1", + attrs: (:), + children: ("Hello, world!",), + ), + "\n \n\n", + ), + ), + ), +),)) + +--- html-invalid --- +// Error: 14-38 failed to parse HTML (Unexpected token) +#html-decode("/assets/text/hello.txt")