From 71f73d8b3ce63f9a3685bc1a1686ef4fab3294a6 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 21 Sep 2025 15:43:59 -0400 Subject: Deprecate sets --- test/enums.tm | 2 +- test/optionals.tm | 6 +++--- test/serialization.tm | 5 ----- test/sets.tm | 52 --------------------------------------------------- test/structs.tm | 4 ++-- test/tables.tm | 3 --- 6 files changed, 6 insertions(+), 66 deletions(-) delete mode 100644 test/sets.tm (limited to 'test') diff --git a/test/enums.tm b/test/enums.tm index d07182cc..0cef37cf 100644 --- a/test/enums.tm +++ b/test/enums.tm @@ -53,7 +53,7 @@ func main() assert Foo.One(10) < Foo.Two(1, 2) >> x := Foo.One(123) - >> t := |x| + >> t := {x=yes} >> t.has(x) = yes >> t.has(Foo.Zero) diff --git a/test/optionals.tm b/test/optionals.tm index 7bdd2fd1..1f7d640e 100644 --- a/test/optionals.tm +++ b/test/optionals.tm @@ -243,9 +243,9 @@ func main() # Test comparisons, hashing, equality: assert none != 5? assert 5? == 5? - >> nones : |Int?| = |none, none| - >> also_nones : |Int?| = |none| - >> nones == also_nones + >> nones : {Int?=Bool} = {none=yes, none=yes} + >> nones.keys + = [none] >> [5?, none, none, 6?].sorted() = [none, none, 5, 6] diff --git a/test/serialization.tm b/test/serialization.tm index 8e1a4a1c..e2fa38a3 100644 --- a/test/serialization.tm +++ b/test/serialization.tm @@ -66,11 +66,6 @@ func main() >> bytes := obj.serialized() assert deserialize(bytes -> Text?) == obj - do - >> obj := |10, 20, 30| - >> bytes := obj.serialized() - assert deserialize(bytes -> |Int|) == obj - do >> obj : Num? = none >> bytes := obj.serialized() diff --git a/test/sets.tm b/test/sets.tm deleted file mode 100644 index b30c2ce3..00000000 --- a/test/sets.tm +++ /dev/null @@ -1,52 +0,0 @@ - -func main() - t1 := @|10, 20, 30, 10| - >> t1[] - = |10, 20, 30| - >> t1.has(10) - = yes - >> t1.has(-999) - = no - - >> t2 := |30, 40| - - >> t1.with(t2) - >> |10, 20, 30, 40| - - >> t1.without(t2) - >> |10, 20| - - >> t1.overlap(t2) - >> |30| - - - >> |1,2|.is_subset_of(|2,3|) - = no - >> |1,2|.is_subset_of(|1,2,3|) - = yes - >> |1,2|.is_subset_of(|1,2|) - = yes - >> |1,2|.is_subset_of(|1,2|, strict=yes) - = no - - >> t1.add_all(t2) - >> t1[] - = |10, 20, 30, 40| - >> t1.remove_all(t2) - >> t1[] - = |10, 20| - - >> |3, i for i in 5| - = |3, 1, 2, 4, 5| - - >> empty : |Int| = || - = || - - >> |1,2,3| or |3,4| - = |1,2,3,4| - >> |1,2,3| and |3,4| - = |3| - >> |1,2,3| xor |3,4| - = |1,2,4| - >> |1,2,3| - |3,4| - >> |1,2| diff --git a/test/structs.tm b/test/structs.tm index 40c1b566..2440911b 100644 --- a/test/structs.tm +++ b/test/structs.tm @@ -27,7 +27,7 @@ func test_metamethods() assert x != Pair(10, 30) assert x < Pair(11, 20) - >> set := |x| + >> set := {x=yes} >> set.has(x) = yes >> set.has(y) @@ -41,7 +41,7 @@ func test_mixed() assert x == Mixed(10, "Hello") assert x != Mixed(10, "Bye") assert x < Mixed(11, "Hello") - >> set := |x| + >> set := {x=yes} >> set.has(x) = yes >> set.has(y) diff --git a/test/tables.tm b/test/tables.tm index 1f4244f9..587a02c8 100644 --- a/test/tables.tm +++ b/test/tables.tm @@ -97,9 +97,6 @@ func main() >> ints : [{Int=Int}] = [{}, {0=0}, {99=99}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 2=-99, 3=3}, {1=1, 99=-99, 3=4}].sorted() = [{}, {0=0}, {1=1, 2=-99, 3=3}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 99=-99, 3=4}, {99=99}] - >> other_ints : [|Int|] = [||, |1|, |2|, |99|, |0, 3|, |1, 2|, |99|].sorted() - = [||, |0, 3|, |1|, |1, 2|, |2|, |99|, |99|] - do # Default values: counter := &{"x"=10; default=0} -- cgit v1.2.3