diff options
| author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2012-07-20 16:04:22 -0300 |
|---|---|---|
| committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2012-07-20 16:04:22 -0300 |
| commit | c0efcac6a97588f7013b7ec09dd56cb780bdce64 (patch) | |
| tree | 3a63a95aa0b9dc88d89c46fbc9e6f70e5e843d95 /src/pkg/bytes/bytes_test.go | |
| parent | 7bf8355dc7d1a185cb96f66011a3217b99e85f69 (diff) | |
| download | go-c0efcac6a97588f7013b7ec09dd56cb780bdce64.tar.xz | |
bytes: make Join return a new buffer on len(a) == 1
Fixes #3844.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6432054
Diffstat (limited to 'src/pkg/bytes/bytes_test.go')
| -rw-r--r-- | src/pkg/bytes/bytes_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go index 000f235176..0e2ef504cf 100644 --- a/src/pkg/bytes/bytes_test.go +++ b/src/pkg/bytes/bytes_test.go @@ -490,6 +490,12 @@ func TestSplit(t *testing.T) { t.Errorf("Split disagrees withSplitN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a) } } + if len(a) > 0 { + in, out := a[0], s + if cap(in) == cap(out) && &in[:1][0] == &out[:1][0] { + t.Errorf("Join(%#v, %q) didn't copy", a, tt.sep) + } + } } } |
