Better function call tests ✔
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.0 KiB |
BIN
tests/lang/ref/call.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@ -1,4 +1,4 @@
|
|||||||
// Test return value of code blocks.
|
// Test code blocks.
|
||||||
|
|
||||||
---
|
---
|
||||||
All none
|
All none
|
@ -1,34 +0,0 @@
|
|||||||
// Test function call arguments.
|
|
||||||
|
|
||||||
---
|
|
||||||
// One argument.
|
|
||||||
#f(bold)
|
|
||||||
|
|
||||||
// One argument and trailing comma.
|
|
||||||
#f(1,)
|
|
||||||
|
|
||||||
// One named argument.
|
|
||||||
#f(a:2)
|
|
||||||
|
|
||||||
// Mixed arguments.
|
|
||||||
{f(1, a: (3, 4), 2, b: "5")}
|
|
||||||
|
|
||||||
---
|
|
||||||
// Error: 4-5 expected expression, found colon
|
|
||||||
#f(:)
|
|
||||||
|
|
||||||
// Error: 7-9 expected expression, found end of block comment
|
|
||||||
#f(a:1*/)
|
|
||||||
|
|
||||||
// Error: 5 expected comma
|
|
||||||
#f(1 2)
|
|
||||||
|
|
||||||
// Error: 2:4-2:5 expected identifier
|
|
||||||
// Error: 1:6 expected expression
|
|
||||||
#f(1:)
|
|
||||||
|
|
||||||
// Error: 4-5 expected identifier
|
|
||||||
#f(1:2)
|
|
||||||
|
|
||||||
// Error: 4-7 expected identifier
|
|
||||||
{f((x):1)}
|
|
@ -4,6 +4,26 @@
|
|||||||
// Error: 1-2 unexpected invalid token
|
// Error: 1-2 unexpected invalid token
|
||||||
#
|
#
|
||||||
|
|
||||||
|
---
|
||||||
|
// Error: 4-5 expected expression, found colon
|
||||||
|
#f(:)
|
||||||
|
|
||||||
|
// Error: 7-9 expected expression, found end of block comment
|
||||||
|
#f(a:1*/)
|
||||||
|
|
||||||
|
// Error: 5 expected comma
|
||||||
|
#f(1 2)
|
||||||
|
|
||||||
|
// Error: 2:4-2:5 expected identifier
|
||||||
|
// Error: 1:6 expected expression
|
||||||
|
#f(1:)
|
||||||
|
|
||||||
|
// Error: 4-5 expected identifier
|
||||||
|
#f(1:2)
|
||||||
|
|
||||||
|
// Error: 4-7 expected identifier
|
||||||
|
{f((x):1)}
|
||||||
|
|
||||||
---
|
---
|
||||||
#let x = "string"
|
#let x = "string"
|
||||||
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
// Test function calls.
|
|
||||||
// Ref: false
|
|
||||||
|
|
||||||
---
|
|
||||||
// Whitespace is significant.
|
|
||||||
#test(type(1), "integer")
|
|
||||||
#test (type (1), "integer")
|
|
||||||
|
|
||||||
// From variable.
|
|
||||||
#let alias = type
|
|
||||||
#test(alias(alias), "function")
|
|
||||||
|
|
||||||
// Returns template.
|
|
||||||
#test(type(font(12pt)), "template")
|
|
40
tests/lang/typ/call.typ
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// Test function calls.
|
||||||
|
|
||||||
|
---
|
||||||
|
// One argument.
|
||||||
|
#f(bold)
|
||||||
|
|
||||||
|
// One argument and trailing comma.
|
||||||
|
#f(1,)
|
||||||
|
|
||||||
|
// One named argument.
|
||||||
|
#f(a:2)
|
||||||
|
|
||||||
|
// Mixed arguments.
|
||||||
|
{f(1, a: (3, 4), 2, b: "5")}
|
||||||
|
|
||||||
|
---
|
||||||
|
// Different forms of template arguments.
|
||||||
|
// Ref: true
|
||||||
|
|
||||||
|
#let a = "a"
|
||||||
|
|
||||||
|
#f[a] \
|
||||||
|
#f(a) \
|
||||||
|
#f(a, [b]) \
|
||||||
|
#f(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 f> (Okay.)`.
|
||||||
|
#f (Okay.)
|
||||||
|
|
||||||
|
---
|
||||||
|
// Call function assigned to variable.
|
||||||
|
#let alias = type
|
||||||
|
#test(alias(alias), "function")
|
||||||
|
|
||||||
|
// Library function `font` returns template.
|
||||||
|
#test(type(font(12pt)), "template")
|
@ -1,4 +1,4 @@
|
|||||||
// Test which things are iterable.
|
// Test for loops.
|
||||||
// Ref: false
|
// Ref: false
|
||||||
|
|
||||||
---
|
---
|
@ -1,4 +1,4 @@
|
|||||||
// Test conditions of if-else expressions.
|
// Test if-else expressions.
|
||||||
|
|
||||||
---
|
---
|
||||||
// Test condition evaluation.
|
// Test condition evaluation.
|
@ -1,4 +1,4 @@
|
|||||||
// Test value of let binding.
|
// Test let bindings.
|
||||||
// Ref: false
|
// Ref: false
|
||||||
|
|
||||||
---
|
---
|