Procházet zdrojové kódy

Better assertion failure messages from request_test.

Willem van Bergen před 10 roky
rodič
revize
9dbdf89484
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      request_test.go

+ 2 - 2
request_test.go

@@ -48,7 +48,7 @@ func testRequest(t *testing.T, name string, rb requestBody, expected []byte) {
 	if err != nil {
 		t.Error(err)
 	} else if !bytes.Equal(packet[headerSize:], expected) {
-		t.Error("Encoding", name, "failed\ngot ", packet, "\nwant", expected)
+		t.Error("Encoding", name, "failed\ngot ", packet[headerSize:], "\nwant", expected)
 	}
 	// Decoder request
 	decoded, err := decodeRequest(bytes.NewReader(packet))
@@ -57,7 +57,7 @@ func testRequest(t *testing.T, name string, rb requestBody, expected []byte) {
 	} else if decoded.correlationID != 123 || decoded.clientID != "foo" {
 		t.Errorf("Decoded header is not valid: %v", decoded)
 	} else if !reflect.DeepEqual(rb, decoded.body) {
-		t.Errorf("Decoded request does not match the encoded one\nencoded: %v\ndecoded: %v", rb, decoded)
+		t.Errorf("Decoded request does not match the encoded one\nencoded: %v\ndecoded: %v", rb, decoded.body)
 	}
 }