aboutsummaryrefslogtreecommitdiff
path: root/test/structs.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-12 13:09:31 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-12 13:09:31 -0400
commit6c01eef851439549018267fdc439e4884af0c624 (patch)
tree0599dd071b8a5effb67e6a87ed1c34777eb8d8c7 /test/structs.tm
parent17cb6ffd88c4464c513b045f4b06c4e6e46e8f22 (diff)
Introducing the main() function
Diffstat (limited to 'test/structs.tm')
-rw-r--r--test/structs.tm26
1 files changed, 14 insertions, 12 deletions
diff --git a/test/structs.tm b/test/structs.tm
index c038bd07..1d9de8d0 100644
--- a/test/structs.tm
+++ b/test/structs.tm
@@ -1,6 +1,8 @@
struct Pair(x,y:Int)
struct Mixed(x:Int, text:Text)
+struct LinkedList(x:Int, next=!LinkedList)
+struct Password(text:Text; secret)
func test_literals()
>> x := Pair(10, 20)
@@ -11,7 +13,6 @@ func test_literals()
= yes
>> x == Pair(-1, -2)
= no
-test_literals()
func test_metamethods()
>> x := Pair(10, 20)
@@ -30,7 +31,6 @@ func test_metamethods()
= "found"
>> t2[y]
= "missing"
-test_metamethods()
func test_mixed()
>> x := Mixed(10, "Hello")
@@ -48,16 +48,18 @@ func test_mixed()
= "found"
>> t[y]
= "missing"
-test_mixed()
-struct LinkedList(x:Int, next=!LinkedList)
->> @LinkedList(10, @LinkedList(20))
+func main()
+ test_literals()
+ test_metamethods()
+ test_mixed()
-struct Password(text:Text; secret)
->> my_pass := Password("Swordfish")
-= Password(...)
->> users_by_password := {my_pass=> "User1", Password("xxx")=>"User2"}
-= {Password(...)=>"User1", Password(...)=>"User2"}
->> users_by_password[my_pass]
-= "User1"
+ >> @LinkedList(10, @LinkedList(20))
+
+ >> my_pass := Password("Swordfish")
+ = Password(...)
+ >> users_by_password := {my_pass=> "User1", Password("xxx")=>"User2"}
+ = {Password(...)=>"User1", Password(...)=>"User2"}
+ >> users_by_password[my_pass]
+ = "User1"