From bca035172c463e6ac4aaf2591d7d4af2da51c522 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 18 Jun 2021 11:59:05 +0200 Subject: Join semantics --- tests/typ/code/block.typ | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'tests/typ/code/block.typ') diff --git a/tests/typ/code/block.typ b/tests/typ/code/block.typ index 196e6c14..8c30fa64 100644 --- a/tests/typ/code/block.typ +++ b/tests/typ/code/block.typ @@ -9,7 +9,7 @@ All none // Let evaluates to none. { let v = 0 } -// Trailing none evaluates to none. +// Type is joined with trailing none, evaluates to string. { type("") none @@ -19,15 +19,35 @@ All none // Evaluates to single expression. { "Hello" } -// Evaluates to trailing expression. +// Evaluates to string. { let x = "Hel"; x + "lo" } -// Evaluates to concatenation of for loop bodies. +// Evaluates to join of none, [He] and the two loop bodies. { - let parts = ("Hel", "lo") + let parts = ("l", "lo") + [He] for s in parts [{s}] } +--- +// Evaluates to join of the templates and strings. +{ + [Hey, ] + if true { + "there!" + } + [ ] + if false [Nope] + [How are ] + "you?" +} + +{ + [A] + // Error: 5-6 cannot join template with integer + 1 + [B] +} + --- // Works the same way in code environment. // Ref: false -- cgit v1.2.3