ax(ueps): add missing sentinelError.Error() Good/Bad/Ugly tests

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 <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 13:13:39 +01:00
parent dc68334162
commit 2dcdc48a68
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -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())
}
}