aboutsummaryrefslogtreecommitdiff
path: root/test/when.tm
diff options
context:
space:
mode:
Diffstat (limited to 'test/when.tm')
-rw-r--r--test/when.tm19
1 files changed, 12 insertions, 7 deletions
diff --git a/test/when.tm b/test/when.tm
index 77c97af5..d93745dd 100644
--- a/test/when.tm
+++ b/test/when.tm
@@ -1,13 +1,18 @@
# Tests for the 'when' block
func main():
- str := "B"
- when str is "A":
- fail("First")
- is "B":
- say("Success")
- is "C":
- fail("Third")
+ answers := [
+ (
+ when x is "A","B":
+ "A or B"
+ is "C":
+ "C"
+ else:
+ "Other"
+ ) for x in ["A", "B", "C", "D"]
+ ]
+ >> answers
+ = ["A or B", "A or B", "C", "Other"]
n := 23
>> when n is 1: Int64(1)