summaryrefslogtreecommitdiff
path: root/tests/typ/compiler
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-02-27 11:05:16 +0100
committerGitHub <noreply@github.com>2024-02-27 10:05:16 +0000
commit145723b1ef4fa23f1f6665b8907dfe79d0bf83cf (patch)
tree02a7de661ddd5dafa75dfce3e3c8b45a7333b9dc /tests/typ/compiler
parente9ee00a7c0df083663ff5ccca162238b88525e14 (diff)
New context system (#3497)
Diffstat (limited to 'tests/typ/compiler')
-rw-r--r--tests/typ/compiler/content-field.typ5
-rw-r--r--tests/typ/compiler/methods.typ21
-rw-r--r--tests/typ/compiler/recursion.typ4
-rw-r--r--tests/typ/compiler/selector-logical.typ7
4 files changed, 16 insertions, 21 deletions
diff --git a/tests/typ/compiler/content-field.typ b/tests/typ/compiler/content-field.typ
index dab4ec4b..96ce1dca 100644
--- a/tests/typ/compiler/content-field.typ
+++ b/tests/typ/compiler/content-field.typ
@@ -17,10 +17,7 @@
---
// Test it with query.
#set raw(lang: "rust")
-#locate(loc => {
- let elem = query(<myraw>, loc).first()
- elem.lang
-})
+#context query(<myraw>).first().lang
`raw` <myraw>
---
diff --git a/tests/typ/compiler/methods.typ b/tests/typ/compiler/methods.typ
index 9eed5aed..2dce8892 100644
--- a/tests/typ/compiler/methods.typ
+++ b/tests/typ/compiler/methods.typ
@@ -83,20 +83,19 @@
---
// Test length `to-absolute` method.
-
#set text(size: 12pt)
-#style(styles => {
- test((6pt).to-absolute(styles), 6pt)
- test((6pt + 10em).to-absolute(styles), 126pt)
- test((10em).to-absolute(styles), 120pt)
-})
+#context {
+ test((6pt).to-absolute(), 6pt)
+ test((6pt + 10em).to-absolute(), 126pt)
+ test((10em).to-absolute(), 120pt)
+}
#set text(size: 64pt)
-#style(styles => {
- test((6pt).to-absolute(styles), 6pt)
- test((6pt + 10em).to-absolute(styles), 646pt)
- test((10em).to-absolute(styles), 640pt)
-})
+#context {
+ test((6pt).to-absolute(), 6pt)
+ test((6pt + 10em).to-absolute(), 646pt)
+ test((10em).to-absolute(), 640pt)
+}
---
// Error: 2-21 cannot convert a length with non-zero em units (`-6pt + 10.5em`) to pt
diff --git a/tests/typ/compiler/recursion.typ b/tests/typ/compiler/recursion.typ
index f5f870b5..421b638b 100644
--- a/tests/typ/compiler/recursion.typ
+++ b/tests/typ/compiler/recursion.typ
@@ -44,8 +44,8 @@
---
// Test cyclic imports during layout.
-// Error: 14-37 maximum layout depth exceeded
-// Hint: 14-37 try to reduce the amount of nesting in your layout
+// Error: 2-38 maximum show rule depth exceeded
+// Hint: 2-38 check whether the show rule matches its own output
#layout(_ => include "recursion.typ")
---
diff --git a/tests/typ/compiler/selector-logical.typ b/tests/typ/compiler/selector-logical.typ
index 64f97384..5369e4c7 100644
--- a/tests/typ/compiler/selector-logical.typ
+++ b/tests/typ/compiler/selector-logical.typ
@@ -13,10 +13,9 @@
#figure([Iguana], kind: "iguana", supplement: none)
== I
-#let test-selector(selector, ref) = locate(loc => {
- let elems = query(selector, loc)
- test(elems.map(e => e.body), ref)
-})
+#let test-selector(selector, ref) = context {
+ test(query(selector).map(e => e.body), ref)
+}
// Test `or`.
#test-selector(