summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2022-12-29 11:49:01 +0100
committerMartin Haug <mhaug@live.de>2022-12-29 11:49:01 +0100
commitbc535f7b7169d9e0ef26faca108518f4005cc76c (patch)
tree029b76a80215243420d48e0f54e5fdcc8d2869a2 /tests
parent94b90761ebbdf33686e82feb5a89f98d049c5b65 (diff)
`read` function
Diffstat (limited to 'tests')
-rw-r--r--tests/res/hello.txt1
-rw-r--r--tests/res/invalid-utf8.txtbin0 -> 70 bytes
-rw-r--r--tests/typ/compute/data.typ15
3 files changed, 15 insertions, 1 deletions
diff --git a/tests/res/hello.txt b/tests/res/hello.txt
new file mode 100644
index 00000000..5dd01c17
--- /dev/null
+++ b/tests/res/hello.txt
@@ -0,0 +1 @@
+Hello, world! \ No newline at end of file
diff --git a/tests/res/invalid-utf8.txt b/tests/res/invalid-utf8.txt
new file mode 100644
index 00000000..71308112
--- /dev/null
+++ b/tests/res/invalid-utf8.txt
Binary files differ
diff --git a/tests/typ/compute/data.typ b/tests/typ/compute/data.typ
index c1def7d5..5a0f76c6 100644
--- a/tests/typ/compute/data.typ
+++ b/tests/typ/compute/data.typ
@@ -1,7 +1,20 @@
-// Test reading structured data.
+// Test reading structured data and files.
// Ref: false
---
+// Test reading plain text files
+#let data = read("../../res/hello.txt")
+#test(data, "Hello, world!")
+
+---
+// Error: 18-41 file not found (searched at res/missing.txt)
+#let data = read("../../res/missing.txt")
+
+---
+// Error: 18-46 file is not valid utf-8
+#let data = read("../../res/invalid-utf8.txt")
+
+---
// Test reading CSV data.
// Ref: true
#set page(width: auto)