MCPcopy
hub / github.com/IBM/sarama / testEncodable

Function testEncodable

request_test.go:575–583  ·  view source on GitHub ↗

not specific to request tests, just helper functions for testing structures that implement the encoder or decoder interfaces that needed somewhere to live

(t *testing.T, name string, in encoder, expect []byte)

Source from the content-addressed store, hash-verified

573// implement the encoder or decoder interfaces that needed somewhere to live
574
575func testEncodable(t *testing.T, name string, in encoder, expect []byte) {
576 t.Helper()
577 packet, err := encode(in, nil)
578 if err != nil {
579 t.Error(err)
580 } else if !bytes.Equal(packet, expect) {
581 t.Error("Encoding", name, "failed\ngot ", packet, "\nwant", expect)
582 }
583}
584
585func testDecodable(t *testing.T, name string, out decoder, in []byte) {
586 t.Helper()

Calls 3

encodeFunction · 0.85
HelperMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected