Skip to content

Commit

Permalink
Use t.Error where appropriate in Context section (#452)
Browse files Browse the repository at this point in the history
In two instances, `t.Errorf` was being called even though there were no
formatting 'verbs' in the specified errors. They have been replacd with
t.Error in the code snippets in the markdown files as well as the
accompanying code.
  • Loading branch information
lotia authored May 5, 2021
1 parent 0ee0cee commit df677d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions context.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ t.Run("tells store to cancel work if request is cancelled", func(t *testing.T) {
svr.ServeHTTP(response, request)

if !store.cancelled {
t.Errorf("store was not told to cancel")
t.Error("store was not told to cancel")
}
})
```
Expand Down Expand Up @@ -214,14 +214,14 @@ type SpyStore struct {
func (s *SpyStore) assertWasCancelled() {
s.t.Helper()
if !s.cancelled {
s.t.Errorf("store was not told to cancel")
s.t.Error("store was not told to cancel")
}
}

func (s *SpyStore) assertWasNotCancelled() {
s.t.Helper()
if s.cancelled {
s.t.Errorf("store was told to cancel")
s.t.Error("store was told to cancel")
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions context/v2/testdoubles.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func (s *SpyStore) Cancel() {
func (s *SpyStore) assertWasCancelled() {
s.t.Helper()
if !s.cancelled {
s.t.Errorf("store was not told to cancel")
s.t.Error("store was not told to cancel")
}
}

func (s *SpyStore) assertWasNotCancelled() {
s.t.Helper()
if s.cancelled {
s.t.Errorf("store was told to cancel")
s.t.Error("store was told to cancel")
}
}

0 comments on commit df677d3

Please sign in to comment.