aboutsummaryrefslogtreecommitdiff
path: root/test/tables.tm
diff options
context:
space:
mode:
Diffstat (limited to 'test/tables.tm')
-rw-r--r--test/tables.tm21
1 files changed, 18 insertions, 3 deletions
diff --git a/test/tables.tm b/test/tables.tm
index 9749835d..140fd1cf 100644
--- a/test/tables.tm
+++ b/test/tables.tm
@@ -22,7 +22,7 @@ func main():
>> t.length
= 2
>> t.fallback
- = none : {Text,Int}
+ = none : {Text=Int}
>> t.keys
= ["one", "two"]
@@ -96,10 +96,25 @@ func main():
>> {1=1, 2=2} <> {2=2, 1=1}
= Int32(0)
- >> [{:Int,Int}, {0=0}, {99=99}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 2=-99, 3=3}, {1=1, 99=-99, 3=4}]:sorted()
- = [{:Int,Int}, {0=0}, {1=1, 2=-99, 3=3}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 99=-99, 3=4}, {99=99}]
+ >> [{:Int=Int}, {0=0}, {99=99}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 2=-99, 3=3}, {1=1, 99=-99, 3=4}]:sorted()
+ = [{:Int=Int}, {0=0}, {1=1, 2=-99, 3=3}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 99=-99, 3=4}, {99=99}]
>> [{:Int}, {1}, {2}, {99}, {0, 3}, {1, 2}, {99}]:sorted()
= [{:Int}, {0, 3}, {1}, {1, 2}, {2}, {99}, {99}]
+ do:
+ # Default values:
+ counter := &{"x"=10; default=0}
+ >> counter["x"]
+ = 10
+ >> counter["y"]
+ = 0
+ >> counter:has("x")
+ = yes
+ >> counter:has("y")
+ = no
+ >> counter["y"] += 1
+ >> counter
+ >> counter
+ = &{"x"=10, "y"=1; default=0}