aboutsummaryrefslogtreecommitdiff
path: root/test/structs.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-21 17:44:08 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-21 17:44:08 -0400
commitc941b9a3325228eba404455afea7ccea0da45095 (patch)
treed4ca88c6848ac2e6ceee635bb87add87ba6d2322 /test/structs.tm
parent1cec086a6034ad546977cae7aeaf4bb876d21970 (diff)
Fix tests
Diffstat (limited to 'test/structs.tm')
-rw-r--r--test/structs.tm40
1 files changed, 15 insertions, 25 deletions
diff --git a/test/structs.tm b/test/structs.tm
index 2440911b..fdf92d18 100644
--- a/test/structs.tm
+++ b/test/structs.tm
@@ -9,43 +9,36 @@ struct CorecursiveA(other:@CorecursiveB?)
struct CorecursiveB(other:@CorecursiveA?=none)
func test_literals()
- >> Single(123)
- = Single(123)
- >> x := Pair(10, 20)
- = Pair(x=10, y=20)
- >> y := Pair(y=20, 10)
- = Pair(x=10, y=20)
+ assert Single(123) == Single(123)
+ x := Pair(10, 20)
+ assert x == Pair(x=10, y=20)
+ y := Pair(y=20, 10)
+ assert y == Pair(x=10, y=20)
assert x == y
assert x != Pair(-1, -2)
func test_metamethods()
>> x := Pair(10, 20)
>> y := Pair(100, 200)
- >> x == y
- = no
+ assert x == y == no
assert x == Pair(10, 20)
assert x != Pair(10, 30)
assert x < Pair(11, 20)
>> set := {x=yes}
- >> set.has(x)
- = yes
- >> set.has(y)
- = no
+ assert set.has(x) == yes
+ assert set.has(y) == no
func test_mixed()
>> x := Mixed(10, "Hello")
>> y := Mixed(99, "Hello")
- >> x == y
- = no
+ assert x == y == no
assert x == Mixed(10, "Hello")
assert x != Mixed(10, "Bye")
assert x < Mixed(11, "Hello")
>> set := {x=yes}
- >> set.has(x)
- = yes
- >> set.has(y)
- = no
+ assert set.has(x) == yes
+ assert set.has(y) == no
func test_text()
>> b := @CorecursiveB()
@@ -63,14 +56,11 @@ func main()
>> @LinkedList(10, @LinkedList(20))
>> my_pass := Password("Swordfish")
- = Password("Swordfish")
- >> "$my_pass"
- = "Password(...)"
+ assert my_pass == Password("Swordfish")
+ assert "$my_pass" == "Password(...)"
>> users_by_password := {my_pass="User1", Password("xxx")="User2"}
- >> "$users_by_password"
- = '{Password(...)="User1", Password(...)="User2"}'
- >> users_by_password[my_pass]!
- = "User1"
+ assert "$users_by_password" == '{Password(...)="User1", Password(...)="User2"}'
+ assert users_by_password[my_pass]! == "User1"
>> CorecursiveA(@CorecursiveB())