summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorP-Andersson <pierre.andersson01@gmail.com>2023-04-01 14:33:42 +0200
committerGitHub <noreply@github.com>2023-04-01 14:33:42 +0200
commit387bcc3879dbcfac17b215acd9a6b29fe400a016 (patch)
treef40fb672d8f67bf55a68626c4c4f6f9ab247516c /tests
parent9e69a7b161191992f336c09ec711a1e1c9768633 (diff)
add support for loading data from yaml files (#447)
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/compute/data.typ18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/typ/compute/data.typ b/tests/typ/compute/data.typ
index 43746e18..cfd761df 100644
--- a/tests/typ/compute/data.typ
+++ b/tests/typ/compute/data.typ
@@ -42,6 +42,24 @@
#json("/bad.json")
---
+// Test reading YAML data
+#let data = yaml("/yamltypes.yaml")
+#test(data.len(), 7)
+#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"), false)
+---
+
+---
+// Error: 7-18 failed to parse yaml file: while parsing a flow sequence, expected ',' or ']' at line 2 column 1
+#yaml("/bad.yaml")
+
+---
// Test reading XML data.
#let data = xml("/data.xml")
#test(data, ((