From acef50ad625ff3566b0fbcef4a8ebb5a7d07307f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 16:36:41 +0100 Subject: [PATCH] ax(node): rename tt loop variable to testCase in lethean_test.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AX Principle #1 — predictable names over short names. The `tt` loop variable is a two-letter abbreviation with no defined exception in the AX naming rules (only `i`, `_`, `t`, `c` are acceptable short names). Renamed to `testCase` throughout TestParseComment_{Good,Bad,Ugly}. Co-Authored-By: Charon --- pkg/node/lethean_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/node/lethean_test.go b/pkg/node/lethean_test.go index cf0aca9..bee9189 100644 --- a/pkg/node/lethean_test.go +++ b/pkg/node/lethean_test.go @@ -17,10 +17,10 @@ func TestParseComment_Good(t *testing.T) { {"v=lthn1;cap=pool", "cap", "pool"}, {"v=lthn1", "v", "lthn1"}, } - for _, tt := range tests { - result := parseComment(tt.input) - if result[tt.key] != tt.want { - t.Errorf("parseComment(%q)[%q] = %q, want %q", tt.input, tt.key, result[tt.key], tt.want) + for _, testCase := range tests { + result := parseComment(testCase.input) + if result[testCase.key] != testCase.want { + t.Errorf("parseComment(%q)[%q] = %q, want %q", testCase.input, testCase.key, result[testCase.key], testCase.want) } } } @@ -35,10 +35,10 @@ func TestParseComment_Bad(t *testing.T) { {"k=v", "missing", ""}, {"=v", "", ""}, } - for _, tt := range tests { - result := parseComment(tt.input) - if result[tt.key] != tt.want { - t.Errorf("parseComment(%q)[%q] = %q, want %q", tt.input, tt.key, result[tt.key], tt.want) + for _, testCase := range tests { + result := parseComment(testCase.input) + if result[testCase.key] != testCase.want { + t.Errorf("parseComment(%q)[%q] = %q, want %q", testCase.input, testCase.key, result[testCase.key], testCase.want) } } } @@ -55,10 +55,10 @@ func TestParseComment_Ugly(t *testing.T) { {"duplicate keys last wins", "k=first;k=second", "k", "second"}, {"value with equals", "k=v=extra", "k", "v=extra"}, } - for _, tt := range tests { - result := parseComment(tt.input) - if result[tt.key] != tt.want { - t.Errorf("%s: parseComment(%q)[%q] = %q, want %q", tt.name, tt.input, tt.key, result[tt.key], tt.want) + for _, testCase := range tests { + result := parseComment(testCase.input) + if result[testCase.key] != testCase.want { + t.Errorf("%s: parseComment(%q)[%q] = %q, want %q", testCase.name, testCase.input, testCase.key, result[testCase.key], testCase.want) } } }