diff options
| author | Kyle Consalus <consalus@gmail.com> | 2010-12-01 11:59:13 -0800 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2010-12-01 11:59:13 -0800 |
| commit | 009aebdba8f35fb8609635520c58f76742e46996 (patch) | |
| tree | d7eaa78e28e41ba52ca5e3a7f2d8924565e265b5 /src/pkg/bytes/bytes_test.go | |
| parent | 1f90447e3148d05dd093dbf4d36d919269d50390 (diff) | |
| download | go-009aebdba8f35fb8609635520c58f76742e46996.tar.xz | |
Removed bytes.Add and bytes.AddByte; we now have 'append'.
Changed all uses of bytes.Add (aside from those testing bytes.Add) to append(a, b...).
Also ran "gofmt -s" and made use of copy([]byte, string) in the fasta benchmark.
R=golang-dev, r, r2
CC=golang-dev
https://golang.org/cl/3302042
Diffstat (limited to 'src/pkg/bytes/bytes_test.go')
| -rw-r--r-- | src/pkg/bytes/bytes_test.go | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go index 28e7086529..063686ec5d 100644 --- a/src/pkg/bytes/bytes_test.go +++ b/src/pkg/bytes/bytes_test.go @@ -573,45 +573,6 @@ func TestToLower(t *testing.T) { runStringTests(t, ToLower, "ToLower", lowerTest func TestTrimSpace(t *testing.T) { runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests) } -type AddTest struct { - s, t string - cap int -} - -var addtests = []AddTest{ - {"", "", 0}, - {"a", "", 1}, - {"a", "b", 1}, - {"abc", "def", 100}, -} - -func TestAdd(t *testing.T) { - for _, test := range addtests { - b := make([]byte, len(test.s), test.cap) - copy(b, test.s) - b = Add(b, []byte(test.t)) - if string(b) != test.s+test.t { - t.Errorf("Add(%q,%q) = %q", test.s, test.t, string(b)) - } - } -} - -func TestAddByte(t *testing.T) { - const N = 2e5 - b := make([]byte, 0) - for i := 0; i < N; i++ { - b = AddByte(b, byte(i)) - } - if len(b) != N { - t.Errorf("AddByte: too small; expected %d got %d", N, len(b)) - } - for i, c := range b { - if c != byte(i) { - t.Fatalf("AddByte: b[%d] should be %d is %d", i, c, byte(i)) - } - } -} - type RepeatTest struct { in, out string count int |
