net: simplify error messages in tests

This change simplifies unnecessarily redundant error messages in tests.
There's no need to worry any more because package APIs now return
consistent, self-descriptive error values.

Alos renames ambiguous test functions and makes use of test tables.

Change-Id: I7b61027607c4ae2a3cf605d08d58cf449fa27eb2
Reviewed-on: https://go-review.googlesource.com/9662
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
This commit is contained in:
Mikio Hara 2015-05-01 12:38:42 +09:00
parent 9b184fd23c
commit f77e10fb2e
29 changed files with 307 additions and 320 deletions

View file

@ -77,7 +77,7 @@ func TestDNSReadConfig(t *testing.T) {
t.Fatal(conf.err)
}
if !reflect.DeepEqual(conf, tt.want) {
t.Errorf("%s:\n got: %+v\nwant: %+v", tt.name, conf, tt.want)
t.Errorf("%s:\ngot: %+v\nwant: %+v", tt.name, conf, tt.want)
}
}
}
@ -85,7 +85,7 @@ func TestDNSReadConfig(t *testing.T) {
func TestDNSReadMissingFile(t *testing.T) {
conf := dnsReadConfig("a-nonexistent-file")
if !os.IsNotExist(conf.err) {
t.Errorf("Missing resolv.conf:\n got: %v\nwant: %v", conf.err, os.ErrNotExist)
t.Errorf("missing resolv.conf:\ngot: %v\nwant: %v", conf.err, os.ErrNotExist)
}
conf.err = nil
want := &dnsConfig{
@ -95,6 +95,6 @@ func TestDNSReadMissingFile(t *testing.T) {
attempts: 2,
}
if !reflect.DeepEqual(conf, want) {
t.Errorf("Missing resolv.conf:\n got: %+v\nwant: %+v", conf, want)
t.Errorf("missing resolv.conf:\ngot: %+v\nwant: %+v", conf, want)
}
}