ax(node): rename tt loop variable to testCase in lethean_test.go
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:
parent
00025dd324
commit
acef50ad62
1 changed files with 12 additions and 12 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue