1
0
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:
Alan Donovan 2014-05-16 13:06:08 -04:00
parent 18c694293a
commit 174d6e8ca3
2 changed files with 3 additions and 3 deletions

View File

@ -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)
})

View File

@ -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)