From 1f983ced90f1660958eb9ec9854dbbc2b3aa3509 Mon Sep 17 00:00:00 2001 From: Niklas Ausborn Date: Mon, 18 Dec 2023 17:14:21 +0100 Subject: Implement CSV file header rows support. (#2619) Co-authored-by: Laurenz --- tests/typ/compute/data.typ | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/typ/compute/data.typ b/tests/typ/compute/data.typ index c0a6ce50..ae964b3d 100644 --- a/tests/typ/compute/data.typ +++ b/tests/typ/compute/data.typ @@ -22,6 +22,14 @@ #let cells = data.at(0).map(strong) + data.slice(1).flatten() #table(columns: data.at(0).len(), ..cells) +--- +// Test reading CSV data with dictionary rows enabled. +#let data = csv("/files/zoo.csv", row-type: dictionary) +#test(data.len(), 3) +#test(data.at(0).Name, "Debby") +#test(data.at(2).Weight, "150kg") +#test(data.at(1).Species, "Tiger") + --- // Error: 6-16 file not found (searched at typ/compute/nope.csv) #csv("nope.csv") @@ -30,6 +38,11 @@ // Error: 6-22 failed to parse CSV (found 3 instead of 2 fields in line 3) #csv("/files/bad.csv") +--- +// Test error numbering with dictionary rows. +// Error: 6-22 failed to parse CSV (found 3 instead of 2 fields in line 3) +#csv("/files/bad.csv", row-type: dictionary) + --- // Test reading JSON data. #let data = json("/files/zoo.json") -- cgit v1.2.3