From 46b0dbc5a448249ddc9a6ce20465f0fa41de6d64 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 11 Jul 2025 16:05:30 -0400 Subject: Use `assert` more in tests to give better error messages --- test/structs.tm | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'test/structs.tm') diff --git a/test/structs.tm b/test/structs.tm index c340f1c9..a58a9ef7 100644 --- a/test/structs.tm +++ b/test/structs.tm @@ -15,23 +15,18 @@ func test_literals() = Pair(x=10, y=20) >> y := Pair(y=20, 10) = Pair(x=10, y=20) - >> x == y - = yes - >> x == Pair(-1, -2) - = no + assert x == y + assert x != Pair(-1, -2) func test_metamethods() >> x := Pair(10, 20) >> y := Pair(100, 200) >> x == y = no - >> x == Pair(10, 20) - = yes - >> x == Pair(10, 30) - = no + assert x == Pair(10, 20) + assert x != Pair(10, 30) - >> x < Pair(11, 20) - = yes + assert x < Pair(11, 20) >> set := |x| >> set.has(x) = yes @@ -43,12 +38,9 @@ func test_mixed() >> y := Mixed(99, "Hello") >> x == y = no - >> x == Mixed(10, "Hello") - = yes - >> x == Mixed(10, "Bye") - = no - >> x < Mixed(11, "Hello") - = yes + assert x == Mixed(10, "Hello") + assert x != Mixed(10, "Bye") + assert x < Mixed(11, "Hello") >> set := |x| >> set.has(x) = yes -- cgit v1.2.3