forked from TrueCloudLab/distribution
reference: TestNormalizedSplitHostname(): use sub-tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
fa1d14c513
commit
2819bca991
1 changed files with 15 additions and 16 deletions
|
@ -524,22 +524,21 @@ func TestNormalizedSplitHostname(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
failf := func(format string, v ...interface{}) {
|
tc := tc
|
||||||
t.Logf(strconv.Quote(tc.input)+": "+format, v...)
|
t.Run(tc.input, func(t *testing.T) {
|
||||||
t.Fail()
|
t.Parallel()
|
||||||
}
|
named, err := ParseNormalizedNamed(tc.input)
|
||||||
|
if err != nil {
|
||||||
named, err := ParseNormalizedNamed(tc.input)
|
t.Errorf("error parsing name: %s", err)
|
||||||
if err != nil {
|
}
|
||||||
failf("error parsing name: %s", err)
|
domain, name := SplitHostname(named)
|
||||||
}
|
if domain != tc.domain {
|
||||||
domain, name := SplitHostname(named)
|
t.Errorf("unexpected domain: got %q, expected %q", domain, tc.domain)
|
||||||
if domain != tc.domain {
|
}
|
||||||
failf("unexpected domain: got %q, expected %q", domain, tc.domain)
|
if name != tc.name {
|
||||||
}
|
t.Errorf("unexpected name: got %q, expected %q", name, tc.name)
|
||||||
if name != tc.name {
|
}
|
||||||
failf("unexpected name: got %q, expected %q", name, tc.name)
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue