aboutsummaryrefslogtreecommitdiff
path: root/test/enums.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-24 16:07:52 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-24 16:07:52 -0500
commit65f684fb6ab7791ac8641fe2682d7eb5f1c0dde2 (patch)
tree2f18a92fafb1d406af93e2b7aa484889d68ace92 /test/enums.tm
parentc2228bf9861b38f2514d0cc8a270754bb3a03dd7 (diff)
Rename file extensions
Diffstat (limited to 'test/enums.tm')
-rw-r--r--test/enums.tm27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/enums.tm b/test/enums.tm
new file mode 100644
index 00000000..31a93f84
--- /dev/null
+++ b/test/enums.tm
@@ -0,0 +1,27 @@
+enum Foo(Zero, One(x:Int), Two(x,y:Int))
+
+>> Foo__Zero()
+= Foo.Zero()
+>> Foo__One(123)
+= Foo.One(x=123)
+>> Foo__Two(123, 456)
+= Foo.Two(x=123, y=456)
+
+>> Foo__One(10) == Foo__One(10)
+= yes
+
+>> Foo__One(10) == Foo__Zero()
+= no
+
+>> Foo__One(10) == Foo__One(-1)
+= no
+
+>> Foo__One(10) < Foo__Two(1, 2)
+= yes
+
+>> x := Foo__One(123)
+>> t := {x=>"found"; default="missing"}
+>> t[x]
+= "found"
+>> t[Foo__Zero()]
+= "missing"