diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-18 11:59:05 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-18 11:59:05 +0200 |
| commit | bca035172c463e6ac4aaf2591d7d4af2da51c522 (patch) | |
| tree | d17ba4c0208caab1d30f6f2d19821cbd203e37fa /tests/typ/code/block.typ | |
| parent | 8b6391040e3fb2ab5f739e26f88621d63ad5d3cc (diff) | |
Join semantics
Diffstat (limited to 'tests/typ/code/block.typ')
| -rw-r--r-- | tests/typ/code/block.typ | 28 |
1 files changed, 24 insertions, 4 deletions
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,16 +19,36 @@ 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 #test(3, { |
