avoid escapes! h/t @therealplato

This commit is contained in:
Lynn Cyrin 2019-06-26 20:37:17 -07:00
parent 8ba442aca6
commit dcce32597d
1 changed files with 3 additions and 3 deletions

View File

@ -246,17 +246,17 @@ func TestPadLevelText(t *testing.T) {
// Control: the level text should not be padded by default // Control: the level text should not be padded by default
if val.paddedLevelText != "" && strings.Contains(logLineDefault, val.paddedLevelText) { if val.paddedLevelText != "" && strings.Contains(logLineDefault, val.paddedLevelText) {
t.Errorf("log line \"%s\" should not contain the padded level text \"%s\" by default", logLineDefault, val.paddedLevelText) t.Errorf("log line %q should not contain the padded level text %q by default", logLineDefault, val.paddedLevelText)
} }
// Assertion: the level text should still contain the string representation of the level // Assertion: the level text should still contain the string representation of the level
if !strings.Contains(strings.ToLower(logLineWithPadding), val.level.String()) { if !strings.Contains(strings.ToLower(logLineWithPadding), val.level.String()) {
t.Errorf("log line \"%s\" should contain the level text \"%s\" when padding is enabled", logLineWithPadding, val.level.String()) t.Errorf("log line %q should contain the level text %q when padding is enabled", logLineWithPadding, val.level.String())
} }
// Assertion: the level text should be in its padded form now // Assertion: the level text should be in its padded form now
if val.paddedLevelText != "" && !strings.Contains(logLineWithPadding, val.paddedLevelText) { if val.paddedLevelText != "" && !strings.Contains(logLineWithPadding, val.paddedLevelText) {
t.Errorf("log line \"%s\" should contain the padded level text \"%s\" when padding is enabled", logLineWithPadding, val.paddedLevelText) t.Errorf("log line %q should contain the padded level text %q when padding is enabled", logLineWithPadding, val.paddedLevelText)
} }
}) })