From e8470824352064fefbb5d0d30a728211d11cea53 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 26 Jan 2021 21:13:52 +0100 Subject: =?UTF-8?q?Multi-expression=20blocks=20=F0=9F=9B=8D=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/lang/ref/blocks.png | Bin 640 -> 515 bytes tests/lang/ref/if.png | Bin 3970 -> 3840 bytes tests/lang/typ/blocks.typ | 14 +++++--------- tests/lang/typ/bracket-call.typ | 18 +++++++++--------- tests/lang/typ/if.typ | 19 +++++++++---------- 5 files changed, 23 insertions(+), 28 deletions(-) (limited to 'tests') diff --git a/tests/lang/ref/blocks.png b/tests/lang/ref/blocks.png index bc96be95..8dd7f940 100644 Binary files a/tests/lang/ref/blocks.png and b/tests/lang/ref/blocks.png differ diff --git a/tests/lang/ref/if.png b/tests/lang/ref/if.png index 4c390c54..b763034f 100644 Binary files a/tests/lang/ref/if.png and b/tests/lang/ref/if.png differ 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. -- cgit v1.2.3