diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-26 21:13:52 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-26 21:13:52 +0100 |
| commit | e8470824352064fefbb5d0d30a728211d11cea53 (patch) | |
| tree | 128b49fd0609566584d1c2822db25303806e3e43 /tests | |
| parent | aaa48403cdd3d8499584eeca4103865d6425ac1b (diff) | |
Multi-expression blocks 🛍️
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/lang/ref/blocks.png | bin | 640 -> 515 bytes | |||
| -rw-r--r-- | tests/lang/ref/if.png | bin | 3970 -> 3840 bytes | |||
| -rw-r--r-- | tests/lang/typ/blocks.typ | 14 | ||||
| -rw-r--r-- | tests/lang/typ/bracket-call.typ | 18 | ||||
| -rw-r--r-- | tests/lang/typ/if.typ | 19 |
5 files changed, 23 insertions, 28 deletions
diff --git a/tests/lang/ref/blocks.png b/tests/lang/ref/blocks.png Binary files differindex bc96be95..8dd7f940 100644 --- a/tests/lang/ref/blocks.png +++ b/tests/lang/ref/blocks.png diff --git a/tests/lang/ref/if.png b/tests/lang/ref/if.png Binary files differindex 4c390c54..b763034f 100644 --- a/tests/lang/ref/if.png +++ b/tests/lang/ref/if.png diff --git a/tests/lang/typ/blocks.typ b/tests/lang/typ/blocks.typ index 79c092a2..7ef34b8a 100644 --- a/tests/lang/typ/blocks.typ +++ b/tests/lang/typ/blocks.typ @@ -1,21 +1,17 @@ +// Empty. +{} + // Basic expression. {1} -// Error: 1:2-1:2 expected expression -{} - // Bad expression. // Error: 1:2-1:4 expected expression, found invalid token {1u} -// Two expressions are not allowed. -// Error: 1:4-1:5 unexpected integer -{2 3} - // Missing closing brace in nested block. // Error: 1:5-1:5 expected closing brace -{({1) + 2} +{({1) + 1} // Missing closing bracket in template expression. // Error: 1:11-1:11 expected closing bracket -{[_] + [4_} +{[_] + [3_} diff --git a/tests/lang/typ/bracket-call.typ b/tests/lang/typ/bracket-call.typ index fb6ef557..3d1fceb0 100644 --- a/tests/lang/typ/bracket-call.typ +++ b/tests/lang/typ/bracket-call.typ @@ -33,18 +33,18 @@ [f|f|f] // With body. -// Error: 1:6-1:7 expected function name, found integer +// Error: 1:6-1:7 expected identifier, found integer [f | 1 | box][💕] -// Error: 2:2-2:2 expected function name -// Error: 1:3-1:3 expected function name +// Error: 2:2-2:2 expected identifier +// Error: 1:3-1:3 expected identifier [||f true] -// Error: 1:6-1:6 expected function name +// Error: 1:6-1:6 expected identifier [f 1|] -// Error: 2:2-2:2 expected function name -// Error: 1:3-1:3 expected function name +// Error: 2:2-2:2 expected identifier +// Error: 1:3-1:3 expected identifier [|][Nope] // Error: 2:5-2:5 expected closing paren @@ -80,16 +80,16 @@ #let x = "string" [x] -// Error: 1:2-1:3 expected function name, found invalid token +// Error: 1:2-1:3 expected identifier, found invalid token [# 1] -// Error: 4:1-4:1 expected function name +// Error: 4:1-4:1 expected identifier // Error: 3:1-3:1 expected closing bracket [ --- // Ref: false -// Error: 2:2-2:3 expected function name, found closing paren +// Error: 2:2-2:3 expected identifier, found closing paren // Error: 3:1-3:1 expected closing bracket [) diff --git a/tests/lang/typ/if.typ b/tests/lang/typ/if.typ index 68f345ca..ee466a8d 100644 --- a/tests/lang/typ/if.typ +++ b/tests/lang/typ/if.typ @@ -6,15 +6,18 @@ // Braced condition is fine. #if {true} {"3"} -// Newline between body and else-clause. -#if false [] -#else [4] +// Newlines. +#if false [ + +] #else [ + 4 +] // Multiline (condition needs parens because it's terminated by the line break, // just like the right-hand side of a let-binding). -#if +#if ( x -{ +) { "Fi" + "ve" } @@ -44,17 +47,13 @@ a#if } // Error: 1:16-1:16 expected body a#if x b#if (x)c -// Needs if-body expression. -// Error: 1:12-1:12 expected expression -a#if true {} - // Needs else-body. // Error: 1:20-1:20 expected body a#if true [b] #else c // Lone else. // Error: 2:1-2:6 unexpected keyword `#else` -// Error: 1:8-1:8 expected function name +// Error: 1:8-1:8 expected identifier #else [] // Condition must be boolean. If it isn't, neither branch is evaluated. |
