aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-06 18:39:23 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-03-06 18:39:23 -0500
commit1c909015534ac9e94d48d1fe61febb6299ba3da6 (patch)
tree00df7dc7be91a6810b40ccf2c60a4914263d48d6 /test
parent73e559fbe4182828742ac1b1d108bcdc42bc46d6 (diff)
Add 'when' test
Diffstat (limited to 'test')
-rw-r--r--test/when.tm16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/when.tm b/test/when.tm
new file mode 100644
index 00000000..89525c64
--- /dev/null
+++ b/test/when.tm
@@ -0,0 +1,16 @@
+# Tests for the 'when' block
+
+func main():
+ str := "B"
+ when str is "A":
+ fail("First")
+ is "B":
+ say("Success")
+ is "C":
+ fail("Third")
+
+ n := 23
+ >> when n is 1: Int64(1)
+ is 2: Int64(2)
+ is 21 + 2: Int64(23)
+ = 23 : Int64?