github.com/rbisecke/kafka-go@v0.4.27/leavegroup_test.go (about) 1 package kafka 2 3 import ( 4 "bufio" 5 "bytes" 6 "reflect" 7 "testing" 8 ) 9 10 func TestLeaveGroupResponseV0(t *testing.T) { 11 item := leaveGroupResponseV0{ 12 ErrorCode: 2, 13 } 14 15 b := bytes.NewBuffer(nil) 16 w := &writeBuffer{w: b} 17 item.writeTo(w) 18 19 var found leaveGroupResponseV0 20 remain, err := (&found).readFrom(bufio.NewReader(b), b.Len()) 21 if err != nil { 22 t.Error(err) 23 t.FailNow() 24 } 25 if remain != 0 { 26 t.Errorf("expected 0 remain, got %v", remain) 27 t.FailNow() 28 } 29 if !reflect.DeepEqual(item, found) { 30 t.Error("expected item and found to be the same") 31 t.FailNow() 32 } 33 }