diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-09 00:03:57 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-09 00:03:57 +0200 |
| commit | 1927cc86dae1df300b3472c52f1777baf637dc6f (patch) | |
| tree | fb156dd4c1a73d2f6880d10e53dd4f1b911fbd95 /tests/typ/style | |
| parent | bfaf5447a789cd0dbbb1e418bea62fef9edc2b7d (diff) | |
Set, show, wrap in code blocks
Diffstat (limited to 'tests/typ/style')
| -rw-r--r-- | tests/typ/style/set.typ | 14 | ||||
| -rw-r--r-- | tests/typ/style/show-node.typ | 31 | ||||
| -rw-r--r-- | tests/typ/style/wrap.typ | 11 |
3 files changed, 50 insertions, 6 deletions
diff --git a/tests/typ/style/set.typ b/tests/typ/style/set.typ index 24966612..2c12d3e9 100644 --- a/tests/typ/style/set.typ +++ b/tests/typ/style/set.typ @@ -27,5 +27,15 @@ Hello *{x}* #text(fill: forest, x) --- -// Error: 2-10 set, show and wrap are only allowed directly in markup -{set f(x)} +// Test that scoping works as expected. +{ + if true { + set text(blue) + [Blue ] + } + [Not blue] +} + +--- +// Error: 11-25 set is only allowed directly in code and content blocks +{ let x = set text(blue) } diff --git a/tests/typ/style/show-node.typ b/tests/typ/style/show-node.typ index d0586c9d..678ff151 100644 --- a/tests/typ/style/show-node.typ +++ b/tests/typ/style/show-node.typ @@ -49,6 +49,33 @@ Some more text. Another text. --- +// Test set and show in code blocks. +#show node: heading as { + set text(red) + show "ding" as [🛎] + node.body +} + += Heading + +--- +// Test that scoping works as expected. +{ + let world = [ World ] + show c: "W" as strong(c) + world + { + set text(blue) + wrap it in { + show "o" as "Ø" + it + } + world + } + world +} + +--- // Error: 18-22 expected content, found integer #show heading as 1234 = Heading @@ -67,5 +94,5 @@ Another text. #show red as [] --- -// Error: 2-16 set, show and wrap are only allowed directly in markup -{show list as a} +// Error: 7-27 show is only allowed directly in code and content blocks +{ 1 + show heading as none } diff --git a/tests/typ/style/wrap.typ b/tests/typ/style/wrap.typ index 2a9074cb..57f21f99 100644 --- a/tests/typ/style/wrap.typ +++ b/tests/typ/style/wrap.typ @@ -25,5 +25,12 @@ A [_B #wrap c in [*#c*]; C_] D Forest --- -// Error: 6-17 set, show and wrap are only allowed directly in markup -{1 + wrap x in y} +{ + // Error: 3-24 expected remaining block to yield content, found integer + wrap body in 2 * body + 2 +} + +--- +// Error: 4-18 wrap is only allowed directly in code and content blocks +{ (wrap body in 2) * body } |
