Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TestUnreadByte (0.11 sec)

  1. src/bytes/buffer_test.go

    	slice := make([]byte, 0)
    	n, err := b.Read(slice)
    	if err != nil {
    		t.Errorf("read error: %v", err)
    	}
    	if n != 0 {
    		t.Errorf("wrong count; got %d want 0", n)
    	}
    }
    
    func TestUnreadByte(t *testing.T) {
    	b := new(Buffer)
    
    	// check at EOF
    	if err := b.UnreadByte(); err == nil {
    		t.Fatal("UnreadByte at EOF: got no error")
    	}
    	if _, err := b.ReadByte(); err == nil {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 18.6K bytes
    - Viewed (0)
  2. src/bufio/bufio_test.go

    	br := NewReader(strings.NewReader("example"))
    	br.WriteTo(io.Discard)
    	if err := br.UnreadByte(); err == nil {
    		t.Error("UnreadByte didn't fail after WriteTo")
    	}
    }
    
    func TestUnreadByte(t *testing.T) {
    	segments := []string{"Hello, ", "world"}
    	r := NewReader(&StringReader{data: segments})
    	got := ""
    	want := strings.Join(segments, "")
    	// Normal execution.
    	for {
    		b1, err := r.ReadByte()
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Fri Nov 01 21:52:12 UTC 2024
    - 51.6K bytes
    - Viewed (0)
Back to top