diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-29 13:37:25 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-29 14:18:13 +0100 |
| commit | 0efe669278a5e1c3f2985eba2f3360e91159c54a (patch) | |
| tree | 502712857c48f0decb5e698257c0a96d358a436e /tests/typ/compiler/set.typ | |
| parent | 836692e73cff0356e409a9ba5b4887b86809d4ca (diff) | |
Reorganize library and tests
Diffstat (limited to 'tests/typ/compiler/set.typ')
| -rw-r--r-- | tests/typ/compiler/set.typ | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/typ/compiler/set.typ b/tests/typ/compiler/set.typ new file mode 100644 index 00000000..fc5053b1 --- /dev/null +++ b/tests/typ/compiler/set.typ @@ -0,0 +1,66 @@ +// General tests for set. + +--- +// Test that text is affected by instantiation-site bold. +#let x = [World] +Hello *{x}* + +--- +// Test that lists are affected by correct indents. +#let fruit = [ + - Apple + - Orange + #list(body-indent: 20pt, [Pear]) +] + +- Fruit +[#set list(indent: 10pt) + #fruit] +- No more fruit + +--- +// Test that that block spacing and text style are respected from +// the outside, but the more specific fill is respected. +#set block(spacing: 4pt) +#set text(style: "italic", fill: eastern) +#let x = [And the forest #parbreak() lay silent!] +#text(fill: forest, x) + +--- +// Test that scoping works as expected. +{ + if true { + set text(blue) + [Blue ] + } + [Not blue] +} + +--- +// Test relative path resolving in layout phase. +#let choice = ("monkey.svg", "rhino.png", "tiger.jpg") +#set enum(label: n => { + let path = "../../res/" + choice(n - 1) + move(dy: -0.15em, image(path, width: 1em, height: 1em)) +}) + ++ Monkey ++ Rhino ++ Tiger + +--- +// Test conditional set. +#show ref: it => { + set text(red) if it.target == "unknown" + it +} + +@hello from the @unknown + +--- +// Error: 19-24 expected boolean, found integer +#set text(red) if 1 + 2 + +--- +// Error: 11-25 set is only allowed directly in code and content blocks +{ let x = set text(blue) } |
