From f4dbfcc251f2481fb1cae3d4e0c848ec03c06b1e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 08:55:11 +0100 Subject: [PATCH] ax(ueps): rename generic 'result' to 'encodedTLV' in writeTLV tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AX Principle 1 — predictable names over short names. 'result' does not describe what it holds; 'encodedTLV' names the TLV-encoded byte slice exactly, matching the function under test. Co-Authored-By: Charon --- pkg/ueps/packet_test.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/ueps/packet_test.go b/pkg/ueps/packet_test.go index c6b8751..e8b47e4 100644 --- a/pkg/ueps/packet_test.go +++ b/pkg/ueps/packet_test.go @@ -147,18 +147,18 @@ func TestPacket_writeTLV_Good(t *testing.T) { if err != nil { t.Fatalf("writeTLV failed: %v", err) } - result := buffer.Bytes() - if len(result) != 3 { - t.Fatalf("expected 3 bytes, got %d", len(result)) + encodedTLV := buffer.Bytes() + if len(encodedTLV) != 3 { + t.Fatalf("expected 3 bytes, got %d", len(encodedTLV)) } - if result[0] != TagVersion { - t.Errorf("expected tag 0x%02x, got 0x%02x", TagVersion, result[0]) + if encodedTLV[0] != TagVersion { + t.Errorf("expected tag 0x%02x, got 0x%02x", TagVersion, encodedTLV[0]) } - if result[1] != 0x01 { - t.Errorf("expected length 1, got %d", result[1]) + if encodedTLV[1] != 0x01 { + t.Errorf("expected length 1, got %d", encodedTLV[1]) } - if result[2] != 0x09 { - t.Errorf("expected value 0x09, got 0x%02x", result[2]) + if encodedTLV[2] != 0x09 { + t.Errorf("expected value 0x09, got 0x%02x", encodedTLV[2]) } } @@ -185,14 +185,14 @@ func TestPacket_writeTLV_Ugly(t *testing.T) { if err != nil { t.Fatalf("writeTLV with empty value failed: %v", err) } - result := buffer.Bytes() - if len(result) != 2 { - t.Fatalf("expected 2 bytes for empty value, got %d", len(result)) + encodedTLV := buffer.Bytes() + if len(encodedTLV) != 2 { + t.Fatalf("expected 2 bytes for empty value, got %d", len(encodedTLV)) } - if result[0] != TagIntent { - t.Errorf("expected tag 0x%02x, got 0x%02x", TagIntent, result[0]) + if encodedTLV[0] != TagIntent { + t.Errorf("expected tag 0x%02x, got 0x%02x", TagIntent, encodedTLV[0]) } - if result[1] != 0x00 { - t.Errorf("expected length 0, got %d", result[1]) + if encodedTLV[1] != 0x00 { + t.Errorf("expected length 0, got %d", encodedTLV[1]) } }