Closed mfederowicz closed 8 months ago
Hi @mfederowicz, thanks for reporting the issue. Is not clear to me in which cases tests try to compare strings with color codes.
in TestReviveFormat test there is:
errorMsgs := []string{
"(91, 3) https://revive.run/r#unreachable-code unreachable code after this statement",
"(98, 3) https://revive.run/r#unreachable-code unreachable code after this statement",
"(15, 2) https://revive.run/r#if-return redundant if ...; err != nil check, just return error instead.",
"(88, 3) https://revive.run/r#if-return redundant if ...; err != nil check, just return error instead.",
"(95, 3) https://revive.run/r#if-return redundant if ...; err != nil check, just return error instead.",
}
for _, errorMsg := range errorMsgs {
if !strings.Contains(failures, errorMsg) {
t.Fatalf("Expected formatted failures\n'%s'\nto contain\n'%s', but it didn't.", failures, errorMsg)
}
}
when we try if !strings.Contains(failures, errorMsg) variable failures have output from formatter with color marks and compare
(91, 3) https://revive.run/r#unreachable-code unreachable code after this statement <- against the same string but wrapped with ascii color markers (under console you see colors: green, red, yellow) results with false :(
of course when you run go test ./... in main directory there is no error, error is when you run go test in /revivelib directory
Closed by #926
Describe the bug When we try to compare strings which contains color codes in output, there are some errors
To Reproduce Steps to reproduce the behavior: