1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:50:04 -07:00

net/mail: add test index to error messages in a recent test

Add the test index so it is easier to find which test case failed.

Change-Id: Ic04682651b26b137355950ff0c51bdbdb1d85a9c
Reviewed-on: https://go-review.googlesource.com/17351
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alexandre Cesaro 2015-12-02 23:28:49 +01:00 committed by Brad Fitzpatrick
parent e65db59c12
commit 69c09afb0d

View File

@ -613,17 +613,17 @@ func TestAddressFormattingAndParsing(t *testing.T) {
&Address{Name: "naé, mée", Address: "test.mail@gmail.com"},
}
for _, test := range tests {
for i, test := range tests {
parsed, err := ParseAddress(test.String())
if err != nil {
t.Errorf("ParseAddr(%q) error: %v", test.String(), err)
t.Errorf("test #%d: ParseAddr(%q) error: %v", i, test.String(), err)
continue
}
if parsed.Name != test.Name {
t.Errorf("Parsed name = %q; want %q", parsed.Name, test.Name)
t.Errorf("test #%d: Parsed name = %q; want %q", i, parsed.Name, test.Name)
}
if parsed.Address != test.Address {
t.Errorf("Parsed address = %q; want %q", parsed.Address, test.Address)
t.Errorf("test #%d: Parsed address = %q; want %q", i, parsed.Address, test.Address)
}
}
}