summaryrefslogtreecommitdiff
path: root/tests/typ/expr/block.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-20 17:53:40 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-20 23:34:33 +0100
commit05727bfc3a9cfd45a8e2028dfd0806f7a8f88015 (patch)
tree6c0b66eb2a9dff224cb39eb6ccb478656a706c04 /tests/typ/expr/block.typ
parent927341d93ae29678095e3b874bd68bfc57d4bc05 (diff)
Reorganize tests 🔀
Diffstat (limited to 'tests/typ/expr/block.typ')
-rw-r--r--tests/typ/expr/block.typ38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/typ/expr/block.typ b/tests/typ/expr/block.typ
new file mode 100644
index 00000000..196e6c14
--- /dev/null
+++ b/tests/typ/expr/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
+})