mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
Add tests
This commit is contained in:
parent
1130d6b746
commit
e4c316f2cc
46
tests/suite/loading/html.typ
Normal file
46
tests/suite/loading/html.typ
Normal file
@ -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")
|
Loading…
x
Reference in New Issue
Block a user