From 2dcdc48a6898b194c252ab503b1e0ce835dee1bd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 13:13:39 +0100 Subject: [PATCH] ax(ueps): add missing sentinelError.Error() Good/Bad/Ugly tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TestPacket_sentinelError_{Good,Bad,Ugly} were absent — AX requires all three test categories for every exported and package-level function. The Error() method on sentinelError had no direct coverage. Co-Authored-By: Charon --- pkg/ueps/packet_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/pkg/ueps/packet_test.go b/pkg/ueps/packet_test.go index 317dc1d..0e24446 100644 --- a/pkg/ueps/packet_test.go +++ b/pkg/ueps/packet_test.go @@ -206,3 +206,34 @@ func TestPacket_writeTLV_Ugly(t *testing.T) { t.Errorf("expected length 0, got %d", encodedTLV[1]) } } + +// var e sentinelError = "record not found"; e.Error() == "record not found" +func TestPacket_sentinelError_Good(t *testing.T) { + e := sentinelError("record not found") + + if e.Error() != "record not found" { + t.Errorf("expected %q, got %q", "record not found", e.Error()) + } +} + +// var e sentinelError = ""; e.Error() == "" (empty message is valid sentinel) +func TestPacket_sentinelError_Bad(t *testing.T) { + e := sentinelError("") + + if e.Error() != "" { + t.Errorf("expected empty string, got %q", e.Error()) + } +} + +// var a, b sentinelError = "x", "x"; a == b (sentinel identity: same message = same error) +func TestPacket_sentinelError_Ugly(t *testing.T) { + a := sentinelError("integrity violation") + b := sentinelError("integrity violation") + + if a != b { + t.Errorf("expected sentinel identity: %q == %q", a, b) + } + if a.Error() != b.Error() { + t.Errorf("expected identical Error() output, got %q vs %q", a.Error(), b.Error()) + } +}