Set.to_text should not assume contents are Text (#9548)

`Set.to_text` fails if the contents are anything other than `Text`.
This commit is contained in:
GregoryTravis 2024-03-27 15:20:31 -04:00 committed by GitHub
parent e262801daa
commit b74fb5c5c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -133,7 +133,7 @@ type Set
## PRIVATE
to_text : Text
to_text self = self.to_vector.join ", " "Set{" "}"
to_text self = self.to_vector.map .pretty . join ", " "Set{" "}"
## PRIVATE
type Set_Comparator

View File

@ -62,6 +62,12 @@ add_specs suite_builder =
(s1 == s1) . should_be_true
(s1 == s3) . should_be_false
group_builder.specify "should be able to convert to text" <|
s1 = Set.from_vector ["1", "2", "3"]
s2 = Set.from_vector [1, 2, 3]
s1.to_text.should_equal "Set{'1', '2', '3'}"
s2.to_text.should_equal "Set{1, 2, 3}"
main filter=Nothing =
suite = Test.build suite_builder->
add_specs suite_builder