summaryrefslogtreecommitdiff
path: root/tests/suite/loading/yaml.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-04-13 10:39:45 +0200
committerGitHub <noreply@github.com>2024-04-13 08:39:45 +0000
commit020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch)
treec0027ad22046e2726c22298461327823d6b88d53 /tests/suite/loading/yaml.typ
parent72dd79210602ecc799726fc096b078afbb47f299 (diff)
Better test runner (#3922)
Diffstat (limited to 'tests/suite/loading/yaml.typ')
-rw-r--r--tests/suite/loading/yaml.typ17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/suite/loading/yaml.typ b/tests/suite/loading/yaml.typ
new file mode 100644
index 00000000..bbfea41c
--- /dev/null
+++ b/tests/suite/loading/yaml.typ
@@ -0,0 +1,17 @@
+--- yaml ---
+// Test reading YAML data
+#let data = yaml("/assets/data/yaml-types.yaml")
+#test(data.len(), 9)
+#test(data.null_key, (none, none))
+#test(data.string, "text")
+#test(data.integer, 5)
+#test(data.float, 1.12)
+#test(data.mapping, ("1": "one", "2": "two"))
+#test(data.seq, (1,2,3,4))
+#test(data.bool, false)
+#test(data.keys().contains("true"), true)
+#test(data.at("1"), "ok")
+
+--- yaml-invalid ---
+// Error: 7-30 failed to parse YAML (did not find expected ',' or ']' at line 2 column 1, while parsing a flow sequence at line 1 column 18)
+#yaml("/assets/data/bad.yaml")