Skip to content

Commit

Permalink
Set.to_text should not assume contents are Text (#9548)
Browse files Browse the repository at this point in the history
`Set.to_text` fails if the contents are anything other than `Text`.
  • Loading branch information
GregoryTravis authored Mar 27, 2024
1 parent e262801 commit b74fb5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion distribution/lib/Standard/Base/0.0.0-dev/src/Data/Set.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/Base_Tests/src/Data/Set_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b74fb5c

Please sign in to comment.