blob: 76953580f53e13c93a70d3ee520a02ae42051f8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Test function calls.
---
// One argument.
#args(bold)
// One argument and trailing comma.
#args(1,)
// One named argument.
#args(a:2)
// 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.
#let a = "a"
#args(a) \
#args[a] \
#args(a, [b])
// Template can be argument or body depending on whitespace.
#if "template" == type[b] [Sure ]
#if "template" == type [Nope.] #else [thing.]
// Should output `<function args> (Okay.)`.
#args (Okay.)
|