Skip to content

Commit 9f0d3e7

Browse files
fix: fix inconsistent definition of assertError function in maps section (#765)
1 parent 7c5b39c commit 9f0d3e7

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

maps.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,9 @@ func TestAdd(t *testing.T) {
363363
assertDefinition(t, dictionary, word, definition)
364364
})
365365
}
366-
367-
func assertError(t testing.TB, got, want error) {
368-
t.Helper()
369-
if got != want {
370-
t.Errorf("got %q want %q", got, want)
371-
}
372-
}
373366
```
374367

375-
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.
368+
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.
376369

377370
## Try to run test
378371

maps/v1/dictionary_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ func assertStrings(t testing.TB, got, want string) {
1515
t.Helper()
1616

1717
if got != want {
18-
t.Errorf("got %q want %q", got, want)
18+
t.Errorf("got error %q want %q", got, want)
1919
}
2020
}

0 commit comments

Comments
 (0)