diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-04-12 13:09:31 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-04-12 13:09:31 -0400 |
| commit | 6c01eef851439549018267fdc439e4884af0c624 (patch) | |
| tree | 0599dd071b8a5effb67e6a87ed1c34777eb8d8c7 /test/enums.tm | |
| parent | 17cb6ffd88c4464c513b045f4b06c4e6e46e8f22 (diff) | |
Introducing the main() function
Diffstat (limited to 'test/enums.tm')
| -rw-r--r-- | test/enums.tm | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/test/enums.tm b/test/enums.tm index aea18948..f321af8c 100644 --- a/test/enums.tm +++ b/test/enums.tm @@ -1,34 +1,35 @@ 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" - -when x is o:One - >> o.x - = 123 -else - fail("Oops") +func main() + >> 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" + + when x is o:One + >> o.x + = 123 + else + fail("Oops") |
