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

Function TestDeleteTopicsResponseV1

deletetopics_test.go:31–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestDeleteTopicsResponseV1(t *testing.T) {
32 item := deleteTopicsResponse{
33 TopicErrorCodes: []deleteTopicsResponseV0TopicErrorCode{
34 {
35 Topic: "a",
36 ErrorCode: 7,
37 },
38 },
39 }
40
41 b := bytes.NewBuffer(nil)
42 w := &writeBuffer{w: b}
43 item.writeTo(w)
44
45 var found deleteTopicsResponse
46 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
47 if err != nil {
48 t.Fatal(err)
49 }
50 if remain != 0 {
51 t.Fatalf("expected 0 remain, got %v", remain)
52 }
53 if !reflect.DeepEqual(item, found) {
54 t.Fatal("expected item and found to be the same")
55 }
56}

Callers

nothing calls this directly

Calls 4

writeToMethod · 0.95
NewReaderMethod · 0.65
LenMethod · 0.65
readFromMethod · 0.45

Tested by

no test coverage detected