diff --git a/tests/lang/ref/block-value.png b/tests/lang/ref/block.png similarity index 100% rename from tests/lang/ref/block-value.png rename to tests/lang/ref/block.png diff --git a/tests/lang/ref/call-args.png b/tests/lang/ref/call-args.png deleted file mode 100644 index b288be224..000000000 Binary files a/tests/lang/ref/call-args.png and /dev/null differ diff --git a/tests/lang/ref/call-invalid.png b/tests/lang/ref/call-invalid.png index 05db4b7ea..f6c2d67f2 100644 Binary files a/tests/lang/ref/call-invalid.png and b/tests/lang/ref/call-invalid.png differ diff --git a/tests/lang/ref/call.png b/tests/lang/ref/call.png new file mode 100644 index 000000000..d44d7178a Binary files /dev/null and b/tests/lang/ref/call.png differ diff --git a/tests/lang/ref/for-loop.png b/tests/lang/ref/for.png similarity index 100% rename from tests/lang/ref/for-loop.png rename to tests/lang/ref/for.png diff --git a/tests/lang/ref/if-branch.png b/tests/lang/ref/if.png similarity index 100% rename from tests/lang/ref/if-branch.png rename to tests/lang/ref/if.png diff --git a/tests/lang/typ/block-value.typ b/tests/lang/typ/block.typ similarity index 93% rename from tests/lang/typ/block-value.typ rename to tests/lang/typ/block.typ index 4a075c03d..196e6c145 100644 --- a/tests/lang/typ/block-value.typ +++ b/tests/lang/typ/block.typ @@ -1,4 +1,4 @@ -// Test return value of code blocks. +// Test code blocks. --- All none diff --git a/tests/lang/typ/call-args.typ b/tests/lang/typ/call-args.typ deleted file mode 100644 index 53ae0b974..000000000 --- a/tests/lang/typ/call-args.typ +++ /dev/null @@ -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)} diff --git a/tests/lang/typ/call-invalid.typ b/tests/lang/typ/call-invalid.typ index 153f7a392..56b23a195 100644 --- a/tests/lang/typ/call-invalid.typ +++ b/tests/lang/typ/call-invalid.typ @@ -4,6 +4,26 @@ // 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" diff --git a/tests/lang/typ/call-value.typ b/tests/lang/typ/call-value.typ deleted file mode 100644 index 26e48d0f2..000000000 --- a/tests/lang/typ/call-value.typ +++ /dev/null @@ -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") diff --git a/tests/lang/typ/call.typ b/tests/lang/typ/call.typ new file mode 100644 index 000000000..101fb99c2 --- /dev/null +++ b/tests/lang/typ/call.typ @@ -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 ` (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") diff --git a/tests/lang/typ/for-loop.typ b/tests/lang/typ/for.typ similarity index 95% rename from tests/lang/typ/for-loop.typ rename to tests/lang/typ/for.typ index e38ed1902..294345b51 100644 --- a/tests/lang/typ/for-loop.typ +++ b/tests/lang/typ/for.typ @@ -1,4 +1,4 @@ -// Test which things are iterable. +// Test for loops. // Ref: false --- diff --git a/tests/lang/typ/if-branch.typ b/tests/lang/typ/if.typ similarity index 93% rename from tests/lang/typ/if-branch.typ rename to tests/lang/typ/if.typ index 64523a637..4ed6b6496 100644 --- a/tests/lang/typ/if-branch.typ +++ b/tests/lang/typ/if.typ @@ -1,4 +1,4 @@ -// Test conditions of if-else expressions. +// Test if-else expressions. --- // Test condition evaluation. diff --git a/tests/lang/typ/let-value.typ b/tests/lang/typ/let.typ similarity index 82% rename from tests/lang/typ/let-value.typ rename to tests/lang/typ/let.typ index 700d337d6..e609d3a9c 100644 --- a/tests/lang/typ/let-value.typ +++ b/tests/lang/typ/let.typ @@ -1,4 +1,4 @@ -// Test value of let binding. +// Test let bindings. // Ref: false ---