From 387bcc3879dbcfac17b215acd9a6b29fe400a016 Mon Sep 17 00:00:00 2001 From: P-Andersson Date: Sat, 1 Apr 2023 14:33:42 +0200 Subject: add support for loading data from yaml files (#447) --- tests/typ/compute/data.typ | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/typ/compute/data.typ') 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 @@ -41,6 +41,24 @@ // Error: 7-18 failed to parse json file: syntax error in line 3 #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") -- cgit v1.2.3