From 8b58171d7ca036d71b32749286c251cc91bdd10e Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 18 May 2021 00:36:11 +0200 Subject: Reorganize test cases --- tests/typ/code/block.typ | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/typ/code/block.typ (limited to 'tests/typ/code/block.typ') diff --git a/tests/typ/code/block.typ b/tests/typ/code/block.typ new file mode 100644 index 00000000..196e6c14 --- /dev/null +++ b/tests/typ/code/block.typ @@ -0,0 +1,38 @@ +// Test code blocks. + +--- +All none + +// Nothing evaluates to none. +{} + +// Let evaluates to none. +{ let v = 0 } + +// Trailing none evaluates to none. +{ + type("") + none +} + +--- +// Evaluates to single expression. +{ "Hello" } + +// Evaluates to trailing expression. +{ let x = "Hel"; x + "lo" } + +// Evaluates to concatenation of for loop bodies. +{ + let parts = ("Hel", "lo") + for s in parts [{s}] +} + +--- +// Works the same way in code environment. +// Ref: false +#test(3, { + let x = 1 + let y = 2 + x + y +}) -- cgit v1.2.3