mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Update test logs for uniformity and consistency
Many minor fixes to make test logs more consistent and correct a
mispelling.
Standardize on "[%i] got X but expected Y" for log messages. Using
a consistent layout makes it easier to read the test results. This
was mostly changing "Got" to "got". Swapped the order of values on
several calls to bring them in line with the convention.
A few log messages had a sequence number added to identify the
exact scenario that failed. Otherwise, there would be no way to
ascertain which failed When there are many scenarios.
Correct spelling of "expected."
Fixes #1028
Merged be2097e1ad
[close #1040]
This commit is contained in:
@@ -27,7 +27,7 @@ func CheckShortCodeMatch(t *testing.T, input, expected string, template tpl.Temp
|
||||
}
|
||||
|
||||
if output != expected {
|
||||
t.Fatalf("Shortcode render didn't match. Expected: %q, Got: %q", expected, output)
|
||||
t.Fatalf("Shortcode render didn't match. got %q but exxpected %q", output, expected)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,8 +260,8 @@ func TestExtractShortcodes(t *testing.T) {
|
||||
} else {
|
||||
r, _ := regexp.Compile(this.expectErrorMsg)
|
||||
if !r.MatchString(err.Error()) {
|
||||
t.Fatalf("[%d] %s: ExtractShortcodes didn't return an expected error message, expected %s got %s",
|
||||
i, this.name, this.expectErrorMsg, err.Error())
|
||||
t.Fatalf("[%d] %s: ExtractShortcodes didn't return an expected error message, got %s but expected %s",
|
||||
i, this.name, err.Error(), this.expectErrorMsg)
|
||||
}
|
||||
}
|
||||
continue
|
||||
@@ -289,7 +289,7 @@ func TestExtractShortcodes(t *testing.T) {
|
||||
}
|
||||
|
||||
if !r.MatchString(content) {
|
||||
t.Fatalf("[%d] %s: Shortcode extract didn't match. Expected: %q, Got: %q", i, this.name, expected, content)
|
||||
t.Fatalf("[%d] %s: Shortcode extract didn't match. got %q but expected %q", i, this.name, content, expected)
|
||||
}
|
||||
|
||||
for placeHolder, sc := range shortCodes {
|
||||
@@ -305,7 +305,7 @@ func TestExtractShortcodes(t *testing.T) {
|
||||
if this.expectShortCodes != "" {
|
||||
shortCodesAsStr := fmt.Sprintf("map%q", collectAndSortShortcodes(shortCodes))
|
||||
if !strings.Contains(shortCodesAsStr, this.expectShortCodes) {
|
||||
t.Fatalf("[%d] %s: Short codes not as expected, got %s - expected to contain %s", i, this.name, shortCodesAsStr, this.expectShortCodes)
|
||||
t.Fatalf("[%d] %s: Short codes not as expected, got %s but expected %s", i, this.name, shortCodesAsStr, this.expectShortCodes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user