ax(node): rename tt loop variable to testCase in lethean_test.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

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 <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 16:36:41 +01:00
parent 00025dd324
commit acef50ad62
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

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