diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-17 18:12:13 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-02-17 18:12:13 +0100 |
| commit | 261f387535ebe3b784d69893027d8edac01e1ba9 (patch) | |
| tree | c255e10d01fa17fd361ec10fb0f1fdf3e5a0a860 /tests/typ | |
| parent | 35610a8c6a1721010b933324dacfe2c4d58761a3 (diff) | |
Accept closures for heading styling
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/style/closure.typ | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/typ/style/closure.typ b/tests/typ/style/closure.typ new file mode 100644 index 00000000..2c9edd81 --- /dev/null +++ b/tests/typ/style/closure.typ @@ -0,0 +1,48 @@ +// Test styles with closure. + +--- +#set heading( + size: 10pt, + fill: lvl => if even(lvl) { red } else { blue }, +) + += Heading 1 +== Heading 2 +=== Heading 3 +==== Heading 4 + +--- +// Test in constructor. +#heading( + level: 3, + size: 10pt, + strong: lvl => { + assert(lvl == 3) + false + } +)[Level 3] + +--- +// Error: 22-26 expected font family or auto or function, found length +#set heading(family: 10pt) += Heading + +--- +// Error: 29-38 cannot add integer and string +#set heading(strong: lvl => lvl + "2") += Heading + +--- +// Error: 22-34 expected font family or auto, found boolean +#set heading(family: lvl => false) += Heading + +--- +// Error: 22-37 missing argument: b +#set heading(family: (a, b) => a + b) += Heading + +--- +// Error: 22-30 unexpected argument +#set heading(family: () => {}) += Heading |
