diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-03 22:33:00 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-03 22:33:00 +0100 |
| commit | 193734f45385b179f40dc0145034204dad3cae8f (patch) | |
| tree | d6601602e57da3414302f9f8fd78b446593a07bf /tests/typ | |
| parent | 1cfc3c72b59f96d1cef3f2e6e488b645648c36ab (diff) | |
Callee expressions 🍅
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/expr/call.typ | 47 | ||||
| -rw-r--r-- | tests/typ/spacing.typ | 4 |
2 files changed, 41 insertions, 10 deletions
diff --git a/tests/typ/expr/call.typ b/tests/typ/expr/call.typ index 213d5554..358322d1 100644 --- a/tests/typ/expr/call.typ +++ b/tests/typ/expr/call.typ @@ -13,6 +13,45 @@ // Mixed arguments. {args(1, b: "2", 3)} +// Should output `() + 2`. +#args() + 2 + +--- +// Ref: false + +// Call function assigned to variable. +#let alias = type +#test(alias(alias), "function") + +// Library function `font` returns template. +#test(type(font(12pt)), "template") + +--- +// Callee expressions. +{ + // Error: 5-9 expected function, found boolean + true() + + // Wrapped in parens. + test((type)("hi"), "string") + + // Call the return value of a function. + let adder(dx) = x => x + dx + test(adder(2)(5), 7) +} + +#let f(x, body) = (y) => { + [{x}] + body + [{y}] +} + +// Call return value of function with body. +#f(1)[2](3) + +// Don't allow this to be a closure. +// Should output `x => "hi"`. +#let x = "x" +#x => "hi" + --- // Different forms of template arguments. // Ref: true @@ -30,11 +69,3 @@ // Should output `<function args> (Okay.)`. #args (Okay.) - ---- -// Call function assigned to variable. -#let alias = type -#test(alias(alias), "function") - -// Library function `font` returns template. -#test(type(font(12pt)), "template") diff --git a/tests/typ/spacing.typ b/tests/typ/spacing.typ index 77dac53c..ccaf084a 100644 --- a/tests/typ/spacing.typ +++ b/tests/typ/spacing.typ @@ -12,8 +12,8 @@ A#let x = 3; B #test(x, 3) \ --- // Spacing around if-else. -A#if true[B]C \ -A#if true[B] C \ +A#if true [B]C \ +A#if true [B] C \ A #if true{"B"}C \ A #if true{"B"} C \ A#if false [] #else [B]C \ |
