MCPcopy
hub / github.com/segmentio/kafka-go / testConnSeekCurrentOffset

Function testConnSeekCurrentOffset

conn_test.go:436–460  ·  view source on GitHub ↗
(t *testing.T, conn *Conn)

Source from the content-addressed store, hash-verified

434}
435
436func testConnSeekCurrentOffset(t *testing.T, conn *Conn) {
437 for i := 0; i != 10; i++ {
438 if _, err := conn.Write([]byte(strconv.Itoa(i))); err != nil {
439 t.Fatal(err)
440 }
441 }
442
443 offset, err := conn.Seek(5, SeekStart)
444 if err != nil {
445 t.Error(err)
446 }
447
448 if offset != 5 {
449 t.Error("bad offset:", offset)
450 }
451
452 offset, err = conn.Seek(-2, SeekCurrent)
453 if err != nil {
454 t.Error(err)
455 }
456
457 if offset != 3 {
458 t.Error("bad offset:", offset)
459 }
460}
461
462func testConnSeekRandomOffset(t *testing.T, conn *Conn) {
463 for i := 0; i != 10; i++ {

Callers

nothing calls this directly

Calls 3

WriteMethod · 0.45
SeekMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected