mirror of
https://github.com/golang/go
synced 2024-11-18 16:14:46 -07:00
go.tools/container/intsets: use " " not ", " as (*Sparse).String() separator.
This is both easier to read and 25% shorter (helpful when using String() as a map key for interning sets). LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/96370045
This commit is contained in:
parent
18c694293a
commit
174d6e8ca3
@ -690,7 +690,7 @@ func (s *Sparse) String() string {
|
||||
buf.WriteByte('{')
|
||||
s.forEach(func(x int) {
|
||||
if buf.Len() > 1 {
|
||||
buf.WriteString(", ")
|
||||
buf.WriteByte(' ')
|
||||
}
|
||||
fmt.Fprintf(&buf, "%d", x)
|
||||
})
|
||||
|
@ -43,8 +43,8 @@ func TestBasics(t *testing.T) {
|
||||
if !s.Insert(435) {
|
||||
t.Errorf("Insert(435): got false, want true")
|
||||
}
|
||||
if s := s.String(); s != "{3, 435}" {
|
||||
t.Errorf("String({3, 435}): got %q, want \"{3, 435}\"", s)
|
||||
if s := s.String(); s != "{3 435}" {
|
||||
t.Errorf("String({3 435}): got %q, want \"{3 435}\"", s)
|
||||
}
|
||||
if max := s.Max(); max != 435 {
|
||||
t.Errorf("Max: got %d, want 435", max)
|
||||
|
Loading…
Reference in New Issue
Block a user