aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/tables.tm31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/tables.tm b/test/tables.tm
new file mode 100644
index 00000000..5b53fc80
--- /dev/null
+++ b/test/tables.tm
@@ -0,0 +1,31 @@
+
+>> t := {"one"=>1, "two"=>2; default=999}
+= {"one"=>1, "two"=>2; default=999}
+>> t["one"]
+= 1
+>> t["two"]
+= 2
+>> t["???"]
+= 999
+>> t.default
+= ?(readonly)999
+>> t.fallback
+= !{Str=>Int64}
+
+>> t.keys
+= ["one", "two"]
+>> t.values
+= [1, 2]
+
+>> t2 := {"three"=>3; fallback=t}
+= {"three"=>3; fallback={"one"=>1, "two"=>2; default=999}}
+>> t2["one"]
+= 1
+>> t2["three"]
+= 3
+>> t2["???"]
+= 999
+>> t2.default
+= !Int64
+>> t2.fallback
+= ?(readonly){"one"=>1, "two"=>2; default=999}