Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
832e72be
Commit
832e72be
authored
Jun 30, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete io.ByteBuffer
R=r DELTA=25 (0 added, 15 deleted, 10 changed) OCL=30892 CL=30892
parent
5d5904bb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
buffer_test.go
src/pkg/bytes/buffer_test.go
+9
-9
Makefile
src/pkg/io/Makefile
+1
-2
No files found.
src/pkg/bytes/buffer_test.go
View file @
832e72be
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// license that can be found in the LICENSE file.
package
io
package
bytes
import
(
import
(
"
io
"
;
"
bytes
"
;
"rand"
;
"rand"
;
"testing"
;
"testing"
;
)
)
...
@@ -24,7 +24,7 @@ func init() {
...
@@ -24,7 +24,7 @@ func init() {
// Verify that contents of buf match the string s.
// Verify that contents of buf match the string s.
func
check
(
t
*
testing
.
T
,
testname
string
,
buf
*
B
yteB
uffer
,
s
string
)
{
func
check
(
t
*
testing
.
T
,
testname
string
,
buf
*
Buffer
,
s
string
)
{
if
buf
.
Len
()
!=
len
(
buf
.
Data
())
{
if
buf
.
Len
()
!=
len
(
buf
.
Data
())
{
t
.
Errorf
(
"%s: buf.Len() == %d, len(buf.Data()) == %d
\n
"
,
testname
,
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) {
...
@@ -42,7 +42,7 @@ func check(t *testing.T, testname string, buf *ByteBuffer, s string) {
// Fill buf through n writes of fub.
// Fill buf through n writes of fub.
// The initial contents of buf corresponds to the string s;
// The initial contents of buf corresponds to the string s;
// the result is the final contents of buf returned as a string.
// the result is the final contents of buf returned as a string.
func
fill
(
t
*
testing
.
T
,
testname
string
,
buf
*
B
yteB
uffer
,
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
);
check
(
t
,
testname
+
" (fill 1)"
,
buf
,
s
);
for
;
n
>
0
;
n
--
{
for
;
n
>
0
;
n
--
{
m
,
err
:=
buf
.
Write
(
fub
);
m
,
err
:=
buf
.
Write
(
fub
);
...
@@ -61,7 +61,7 @@ func fill(t *testing.T, testname string, buf *ByteBuffer, s string, n int, 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.
// Empty buf through repeated reads into fub.
// The initial contents of buf corresponds to the string s.
// The initial contents of buf corresponds to the string s.
func
empty
(
t
*
testing
.
T
,
testname
string
,
buf
*
B
yteB
uffer
,
s
string
,
fub
[]
byte
)
{
func
empty
(
t
*
testing
.
T
,
testname
string
,
buf
*
Buffer
,
s
string
,
fub
[]
byte
)
{
check
(
t
,
testname
+
" (empty 1)"
,
buf
,
s
);
check
(
t
,
testname
+
" (empty 1)"
,
buf
,
s
);
for
{
for
{
...
@@ -81,7 +81,7 @@ func empty(t *testing.T, testname string, buf *ByteBuffer, s string, fub []byte)
...
@@ -81,7 +81,7 @@ func empty(t *testing.T, testname string, buf *ByteBuffer, s string, fub []byte)
func
TestBasicOperations
(
t
*
testing
.
T
)
{
func
TestBasicOperations
(
t
*
testing
.
T
)
{
var
buf
B
yteB
uffer
;
var
buf
Buffer
;
for
i
:=
0
;
i
<
5
;
i
++
{
for
i
:=
0
;
i
<
5
;
i
++
{
check
(
t
,
"TestBasicOperations (1)"
,
&
buf
,
""
);
check
(
t
,
"TestBasicOperations (1)"
,
&
buf
,
""
);
...
@@ -136,7 +136,7 @@ func TestBasicOperations(t *testing.T) {
...
@@ -136,7 +136,7 @@ func TestBasicOperations(t *testing.T) {
func
TestLargeWrites
(
t
*
testing
.
T
)
{
func
TestLargeWrites
(
t
*
testing
.
T
)
{
var
buf
B
yteB
uffer
;
var
buf
Buffer
;
for
i
:=
3
;
i
<
30
;
i
+=
3
{
for
i
:=
3
;
i
<
30
;
i
+=
3
{
s
:=
fill
(
t
,
"TestLargeWrites (1)"
,
&
buf
,
""
,
5
,
data
);
s
:=
fill
(
t
,
"TestLargeWrites (1)"
,
&
buf
,
""
,
5
,
data
);
empty
(
t
,
"TestLargeWrites (2)"
,
&
buf
,
s
,
make
([]
byte
,
len
(
data
)
/
i
));
empty
(
t
,
"TestLargeWrites (2)"
,
&
buf
,
s
,
make
([]
byte
,
len
(
data
)
/
i
));
...
@@ -146,7 +146,7 @@ func TestLargeWrites(t *testing.T) {
...
@@ -146,7 +146,7 @@ func TestLargeWrites(t *testing.T) {
func
TestLargeReads
(
t
*
testing
.
T
)
{
func
TestLargeReads
(
t
*
testing
.
T
)
{
var
buf
B
yteB
uffer
;
var
buf
Buffer
;
for
i
:=
3
;
i
<
30
;
i
+=
3
{
for
i
:=
3
;
i
<
30
;
i
+=
3
{
s
:=
fill
(
t
,
"TestLargeReads (1)"
,
&
buf
,
""
,
5
,
data
[
0
:
len
(
data
)
/
i
]);
s
:=
fill
(
t
,
"TestLargeReads (1)"
,
&
buf
,
""
,
5
,
data
[
0
:
len
(
data
)
/
i
]);
empty
(
t
,
"TestLargeReads (2)"
,
&
buf
,
s
,
make
([]
byte
,
len
(
data
)));
empty
(
t
,
"TestLargeReads (2)"
,
&
buf
,
s
,
make
([]
byte
,
len
(
data
)));
...
@@ -156,7 +156,7 @@ func TestLargeReads(t *testing.T) {
...
@@ -156,7 +156,7 @@ func TestLargeReads(t *testing.T) {
func
TestMixedReadsAndWrites
(
t
*
testing
.
T
)
{
func
TestMixedReadsAndWrites
(
t
*
testing
.
T
)
{
var
buf
B
yteB
uffer
;
var
buf
Buffer
;
s
:=
""
;
s
:=
""
;
for
i
:=
0
;
i
<
50
;
i
++
{
for
i
:=
0
;
i
<
50
;
i
++
{
wlen
:=
rand
.
Intn
(
len
(
data
));
wlen
:=
rand
.
Intn
(
len
(
data
));
...
...
src/pkg/io/Makefile
View file @
832e72be
...
@@ -35,7 +35,6 @@ coverage: packages
...
@@ -35,7 +35,6 @@ coverage: packages
O1
=
\
O1
=
\
io.
$O
\
io.
$O
\
pipe.
$O
\
pipe.
$O
\
xxx.
$O
\
O2
=
\
O2
=
\
utils.
$O
\
utils.
$O
\
...
@@ -45,7 +44,7 @@ phases: a1 a2
...
@@ -45,7 +44,7 @@ phases: a1 a2
_obj$D/io.a
:
phases
_obj$D/io.a
:
phases
a1
:
$(O1)
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)
rm
-f
$(O1)
a2
:
$(O2)
a2
:
$(O2)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment