aboutsummaryrefslogtreecommitdiff
path: root/test/tables.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-21 22:55:03 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-21 22:55:03 -0400
commit0d36812c6af951a41caac77d5f312949f3bc521f (patch)
treeae0f545805c524ffa467b925687bf70e88e2bc58 /test/tables.tm
parentfa7a0ddc0963deb387f0cae7bb22ca968ee9146f (diff)
Deprecate binary ops (other than ++) for tables. Instead use proper
methods: t.with(other), t.without(other), t.intersection(other), t.difference(other)
Diffstat (limited to 'test/tables.tm')
-rw-r--r--test/tables.tm10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/tables.tm b/test/tables.tm
index 7b1ac22c..2eb1409e 100644
--- a/test/tables.tm
+++ b/test/tables.tm
@@ -77,3 +77,13 @@ func main()
assert counter.has("y") == no
>> counter["y"] += 1
+
+ do
+ # Set operations
+ a := {"A":1, "B":2, "C":3}
+ b := {"B":2, "C":30, "D":40}
+ assert a.with(b) == {"A":1, "B":2, "C":30, "D":40}
+ assert a.with(b) == a ++ b
+ assert a.intersection(b) == {"B":2}
+ assert a.difference(b) == {"A":1, "D":40}
+ assert a.without(b) == {"A":1, "C":3}