mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Add ReadByte to bytebuffer
R=rsc APPROVED=rsc DELTA=24 (24 added, 0 deleted, 0 changed) OCL=30459 CL=30540
This commit is contained in:
parent
efc4088ccd
commit
08aab44e48
2 changed files with 24 additions and 0 deletions
|
|
@ -118,6 +118,19 @@ func TestBasicOperations(t *testing.T) {
|
|||
|
||||
empty(t, "TestBasicOperations (9)", &buf, string(data[0 : 20]), make([]byte, 5));
|
||||
empty(t, "TestBasicOperations (10)", &buf, "", make([]byte, 100));
|
||||
|
||||
buf.WriteByte(data[1]);
|
||||
c, err := buf.ReadByte();
|
||||
if err != nil {
|
||||
t.Errorf("ReadByte unexpected eof\n");
|
||||
}
|
||||
if c != data[1] {
|
||||
t.Errorf("ReadByte wrong value c=%v\n", c);
|
||||
}
|
||||
c, err = buf.ReadByte();
|
||||
if err == nil {
|
||||
t.Errorf("ReadByte unexpected not eof\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue