From 09f6f12f08d325c1bfa602467fca6dbbfab85ae7 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 16:56:38 +0100 Subject: [PATCH] ax(node): fix TestProtocol_ValidateResponse_Ugly comment and assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/node/protocol_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/node/protocol_test.go b/pkg/node/protocol_test.go index 90b50cf..6816607 100644 --- a/pkg/node/protocol_test.go +++ b/pkg/node/protocol_test.go @@ -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") } }