Skip to content

Commit

Permalink
fix: fix inconsistent definition of assertError function in maps se…
Browse files Browse the repository at this point in the history
…ction (#765)
  • Loading branch information
dario-piotrowicz authored May 13, 2024
1 parent 7c5b39c commit 9f0d3e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,9 @@ func TestAdd(t *testing.T) {
assertDefinition(t, dictionary, word, definition)
})
}

func assertError(t testing.TB, got, want error) {
t.Helper()
if got != want {
t.Errorf("got %q want %q", got, want)
}
}
```

For this test, we modified `Add` to return an error, which we are validating against a new error variable, `ErrWordExists`. We also modified the previous test to check for a `nil` error, as well as the `assertError` function.
For this test, we modified `Add` to return an error, which we are validating against a new error variable, `ErrWordExists`. We also modified the previous test to check for a `nil` error.

## Try to run test

Expand Down
2 changes: 1 addition & 1 deletion maps/v1/dictionary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ func assertStrings(t testing.TB, got, want string) {
t.Helper()

if got != want {
t.Errorf("got %q want %q", got, want)
t.Errorf("got error %q want %q", got, want)
}
}

0 comments on commit 9f0d3e7

Please sign in to comment.