net/tsaddr: include test input in test failure output

https://go.dev/wiki/CodeReviewComments#useful-test-failures

(Previously it was using subtests with names including the input, but
 once those went away, there was no context left)

Updates #14169

Change-Id: Ib217028183a3d001fe4aee58f2edb746b7b3aa88
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2024-11-20 16:14:13 -08:00 committed by Brad Fitzpatrick
parent af4c3a4a1b
commit 0c8c7c0f90

View File

@ -252,7 +252,7 @@ func TestIsTailscaleIPv4(t *testing.T) {
} }
for _, tt := range tests { for _, tt := range tests {
if got := IsTailscaleIPv4(tt.in); got != tt.want { if got := IsTailscaleIPv4(tt.in); got != tt.want {
t.Errorf("IsTailscaleIPv4() = %v, want %v", got, tt.want) t.Errorf("IsTailscaleIPv4(%v) = %v, want %v", tt.in, got, tt.want)
} }
} }
} }
@ -286,7 +286,7 @@ func TestIsTailscaleIP(t *testing.T) {
} }
for _, tt := range tests { for _, tt := range tests {
if got := IsTailscaleIP(tt.in); got != tt.want { if got := IsTailscaleIP(tt.in); got != tt.want {
t.Errorf("IsTailscaleIP() = %v, want %v", got, tt.want) t.Errorf("IsTailscaleIP(%v) = %v, want %v", tt.in, got, tt.want)
} }
} }
} }