// TestWriteBitErr checks that WriteBit can return an error.
TestWriteBitErr checks that WriteBit can return an error.
// TestWriteBitErr checks that WriteBit can return an error .
func TestWriteBitErr(t *testing.T) {
	lim := limitWriter(5)
	w := NewWriter(&lim, 2)
	for i := 0; i < 4*8; i++ {
		if _, err := w.WriteBit(Bit(i % 2)); err != nil {
			t.Fatalf(`Writing bit %d: err = %v, want nil`, i, err)
		}
	}
	t.Logf(`limit writer before overwrite: %d`, lim)
	for i := 0; i < 8; i++ {
		if _, err := w.WriteBit(Bit(i % 2)); err != nil {
			t.Fatalf(`Writing bit %d: err = %v, want nil`, i, err)
		}
	}
	w.WriteBit(1)
	written, err := w.Commit()
	t.Logf(`limit writer after overwrite: %d`, lim)
	if written != 8 {
		t.Errorf(`written = %v, want 8`, written)
	}
	if err != io.EOF {
		t.Errorf(`err = %v, want io.EOF`, err)
	}
}
func TestWriteBitErr ( t * testing . T ) { lim := limitWriter ( 5 ) w := NewWriter ( & lim , 2 ) for i := 0 ; i < 4 * 8 ; i ++ { if _ , err := w . WriteBit ( Bit ( i % 2 ) ) ; err != nil { t . Fatalf ( `Writing bit %d: err = %v, want nil` , i , err ) } } t . Logf ( `limit writer before overwrite: %d` , lim ) for i := 0 ; i < 8 ; i ++ { if _ , err := w . WriteBit ( Bit ( i % 2 ) ) ; err != nil { t . Fatalf ( `Writing bit %d: err = %v, want nil` , i , err ) } } w . WriteBit ( 1 ) written , err := w . Commit ( ) t . Logf ( `limit writer after overwrite: %d` , lim ) if written != 8 { t . Errorf ( `written = %v, want 8` , written ) } if err != io . EOF { t . Errorf ( `err = %v, want io.EOF` , err ) } }
TestWriteBitErr checks that WriteBit can return an error.
TestWriteBitErr checks that WriteBit can return an error .