aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-10-11 15:31:38 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-10-11 15:31:38 -0400
commit7e8604daeb9239e1669c5414dd6caa37af30c4ff (patch)
tree8fcab61a296381280902a3fc7b2d8456e2a9b227 /test
parent25fa8ace21f0f6874f5b3ad1248e0e5d21190c84 (diff)
Make `{a,b,c}` shorthand for `{a:Empty(), b:Empty(), c:Empty()}` and
display it that way. Same for type annotations.
Diffstat (limited to 'test')
-rw-r--r--test/tables.tm10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/tables.tm b/test/tables.tm
index 2eb1409e..68b77baf 100644
--- a/test/tables.tm
+++ b/test/tables.tm
@@ -87,3 +87,13 @@ func main()
assert a.intersection(b) == {"B":2}
assert a.difference(b) == {"A":1, "D":40}
assert a.without(b) == {"A":1, "C":3}
+
+ do
+ # Set operations with sets
+ a := {"A", "B", "C"}
+ b := {"B", "C", "D"}
+ assert a.with(b) == {"A", "B", "C", "D"}
+ assert a.with(b) == a ++ b
+ assert a.intersection(b) == {"B", "C"}
+ assert a.difference(b) == {"A", "D"}
+ assert a.without(b) == {"A"}