summaryrefslogtreecommitdiff
path: root/tests/suite/model/ref.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/model/ref.typ
parent72dd79210602ecc799726fc096b078afbb47f299 (diff)
Better test runner (#3922)
Diffstat (limited to 'tests/suite/model/ref.typ')
-rw-r--r--tests/suite/model/ref.typ56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/suite/model/ref.typ b/tests/suite/model/ref.typ
new file mode 100644
index 00000000..200f40aa
--- /dev/null
+++ b/tests/suite/model/ref.typ
@@ -0,0 +1,56 @@
+// Test references.
+
+--- ref-basic ---
+#set heading(numbering: "1.")
+
+= Introduction <intro>
+See @setup.
+
+== Setup <setup>
+As seen in @intro, we proceed.
+
+--- ref-label-missing ---
+// Error: 1-5 label `<foo>` does not exist in the document
+@foo
+
+--- ref-label-duplicate ---
+= First <foo>
+= Second <foo>
+
+// Error: 1-5 label `<foo>` occurs multiple times in the document
+@foo
+
+--- ref-supplements ---
+#set heading(numbering: "1.", supplement: [Chapter])
+#set math.equation(numbering: "(1)", supplement: [Eq.])
+
+= Intro
+#figure(
+ image("/assets/images/cylinder.svg", height: 1cm),
+ caption: [A cylinder.],
+ supplement: "Fig",
+) <fig1>
+
+#figure(
+ image("/assets/images/tiger.jpg", height: 1cm),
+ caption: [A tiger.],
+ supplement: "Tig",
+) <fig2>
+
+$ A = 1 $ <eq1>
+
+#set math.equation(supplement: none)
+$ A = 1 $ <eq2>
+
+@fig1, @fig2, @eq1, (@eq2)
+
+#set ref(supplement: none)
+@fig1, @fig2, @eq1, @eq2
+
+--- ref-ambigious ---
+// Test ambiguous reference.
+= Introduction <arrgh>
+
+// Error: 1-7 label occurs in the document and its bibliography
+@arrgh
+#bibliography("/assets/bib/works.bib")