Skip to content

fix tests not passing after the modif of the default rules list #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions revivelib/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,12 @@ func TestReviveLint(t *testing.T) {
failureList = append(failureList, failure)
}

const expected = 3
const expected = 5

got := len(failureList)
if got != expected {
t.Fatalf("Expected failures to have %d failures, but it has %d.", expected, got)
}

errmsg := "redundant if ...; err != nil check, just return error instead."
if failureList[0].Failure != errmsg {
t.Fatalf("Expected failure[0] to be '%s', but it was '%s'", errmsg, failureList[0].Failure)
}
}

func TestReviveFormat(t *testing.T) {
Expand All @@ -57,13 +52,15 @@ func TestReviveFormat(t *testing.T) {
}

errorMsgs := []string{
"(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.",
"(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 '%s' to contain '%s', but it didn't.", failures, errorMsg)
t.Fatalf("Expected formatted failures\n'%s'\nto contain\n'%s', but it didn't.", failures, errorMsg)
}
}

Expand Down