ax(node): fix TestProtocol_ValidateResponse_Ugly comment and assertion
ValidateResponse wraps type-mismatch in *ProtocolError (correct behaviour). The docstring example showed the wrong negation and the assertion fired on every run. Both the comment (AX §2 — comments as accurate usage examples) and the guard were inverted; corrected to !IsProtocolError. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
1e5af44364
commit
09f6f12f08
1 changed files with 3 additions and 3 deletions
|
|
@ -48,7 +48,7 @@ func TestProtocol_ValidateResponse_Bad(t *testing.T) {
|
|||
//
|
||||
// msg, _ := NewMessage(MsgPong, "sender", "receiver", nil)
|
||||
// err := handler.ValidateResponse(msg, MsgStats)
|
||||
// if IsProtocolError(err) { t.Error("type mismatch is not a ProtocolError") }
|
||||
// if !IsProtocolError(err) { t.Error("type mismatch must be a ProtocolError") }
|
||||
func TestProtocol_ValidateResponse_Ugly(t *testing.T) {
|
||||
handler := &ResponseHandler{}
|
||||
|
||||
|
|
@ -57,8 +57,8 @@ func TestProtocol_ValidateResponse_Ugly(t *testing.T) {
|
|||
if err == nil {
|
||||
t.Error("expected error for wrong type")
|
||||
}
|
||||
if IsProtocolError(err) {
|
||||
t.Error("type mismatch should not produce a ProtocolError")
|
||||
if !IsProtocolError(err) {
|
||||
t.Error("type mismatch must produce a ProtocolError")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue