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

Function TestSASLAuthenticateResponseV0

saslauthenticate_test.go:35–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestSASLAuthenticateResponseV0(t *testing.T) {
36 item := saslAuthenticateResponseV0{
37 ErrorCode: 2,
38 ErrorMessage: "Message",
39 Data: []byte("bytes"),
40 }
41
42 b := bytes.NewBuffer(nil)
43 w := &writeBuffer{w: b}
44 item.writeTo(w)
45
46 var found saslAuthenticateResponseV0
47 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len())
48 if err != nil {
49 t.Error(err)
50 t.FailNow()
51 }
52 if remain != 0 {
53 t.Errorf("expected 0 remain, got %v", remain)
54 t.FailNow()
55 }
56 if !reflect.DeepEqual(item, found) {
57 t.Error("expected item and found to be the same")
58 t.FailNow()
59 }
60}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected