]> Cypherpunks repositories - gostls13.git/commitdiff
delete io.ByteBuffer
authorRuss Cox <rsc@golang.org>
Tue, 30 Jun 2009 03:53:05 +0000 (20:53 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 30 Jun 2009 03:53:05 +0000 (20:53 -0700)
R=r
DELTA=25  (0 added, 15 deleted, 10 changed)
OCL=30892
CL=30892

src/pkg/bytes/buffer_test.go
src/pkg/io/Makefile

index 0ba83e916ba786f4d1cc3eeb87cfda8a0f3862a3..76078882c26e143917f1b6a55b95d18a62d7f25e 100644 (file)
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package io
+package bytes
 
 import (
-       "io";
+       "bytes";
        "rand";
        "testing";
 )
@@ -24,7 +24,7 @@ func init() {
 
 
 // Verify that contents of buf match the string s.
-func check(t *testing.T, testname string, buf *ByteBuffer, s string) {
+func check(t *testing.T, testname string, buf *Buffer, s string) {
        if buf.Len() != len(buf.Data()) {
                t.Errorf("%s: buf.Len() == %d, len(buf.Data()) == %d\n", testname, buf.Len(), len(buf.Data()))
        }
@@ -42,7 +42,7 @@ func check(t *testing.T, testname string, buf *ByteBuffer, s string) {
 // Fill buf through n writes of fub.
 // The initial contents of buf corresponds to the string s;
 // the result is the final contents of buf returned as a string.
-func fill(t *testing.T, testname string, buf *ByteBuffer, s string, n int, fub []byte) string {
+func fill(t *testing.T, testname string, buf *Buffer, s string, n int, fub []byte) string {
        check(t, testname + " (fill 1)", buf, s);
        for ; n > 0; n-- {
                m, err := buf.Write(fub);
@@ -61,7 +61,7 @@ func fill(t *testing.T, testname string, buf *ByteBuffer, s string, n int, fub [
 
 // Empty buf through repeated reads into fub.
 // The initial contents of buf corresponds to the string s.
-func empty(t *testing.T, testname string, buf *ByteBuffer, s string, fub []byte) {
+func empty(t *testing.T, testname string, buf *Buffer, s string, fub []byte) {
        check(t, testname + " (empty 1)", buf, s);
 
        for {
@@ -81,7 +81,7 @@ func empty(t *testing.T, testname string, buf *ByteBuffer, s string, fub []byte)
 
 
 func TestBasicOperations(t *testing.T) {
-       var buf ByteBuffer;
+       var buf Buffer;
 
        for i := 0; i < 5; i++ {
                check(t, "TestBasicOperations (1)", &buf, "");
@@ -136,7 +136,7 @@ func TestBasicOperations(t *testing.T) {
 
 
 func TestLargeWrites(t *testing.T) {
-       var buf ByteBuffer;
+       var buf Buffer;
        for i := 3; i < 30; i += 3 {
                s := fill(t, "TestLargeWrites (1)", &buf, "", 5, data);
                empty(t, "TestLargeWrites (2)", &buf, s, make([]byte, len(data)/i));
@@ -146,7 +146,7 @@ func TestLargeWrites(t *testing.T) {
 
 
 func TestLargeReads(t *testing.T) {
-       var buf ByteBuffer;
+       var buf Buffer;
        for i := 3; i < 30; i += 3 {
                s := fill(t, "TestLargeReads (1)", &buf, "", 5, data[0 : len(data)/i]);
                empty(t, "TestLargeReads (2)", &buf, s, make([]byte, len(data)));
@@ -156,7 +156,7 @@ func TestLargeReads(t *testing.T) {
 
 
 func TestMixedReadsAndWrites(t *testing.T) {
-       var buf ByteBuffer;
+       var buf Buffer;
        s := "";
        for i := 0; i < 50; i++ {
                wlen := rand.Intn(len(data));
index e265c99cfd1e76f6d5b6a5c3412560620ef3ef6a..eb3a966ad0a96092dd18c08bb04b411d7de26fe4 100644 (file)
@@ -35,7 +35,6 @@ coverage: packages
 O1=\
        io.$O\
        pipe.$O\
-       xxx.$O\
 
 O2=\
        utils.$O\
@@ -45,7 +44,7 @@ phases: a1 a2
 _obj$D/io.a: phases
 
 a1: $(O1)
-       $(AR) grc _obj$D/io.a io.$O pipe.$O xxx.$O
+       $(AR) grc _obj$D/io.a io.$O pipe.$O
        rm -f $(O1)
 
 a2: $(O2)