Skip to content

Commit

Permalink
Fix some tiny grammatical errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jossy committed Mar 6, 2019
1 parent 9c786f7 commit 8ccca2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions structs-methods-and-interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ Now our tests \(at least the list of cases\) make assertions of truth about shap

Remember earlier when we were implementing `Triangle` and we had the failing test? It printed `shapes_test.go:31: got 0.00 want 36.00`.

We knew this was in relation to `Triangle` because we were just working with it, but what if a bug slipped in to the system in one of 20 cases in the table. How would a developer know which case failed? This is not a great experience for the developer, they will have to manually look through the cases to find out which case actually failed.
We knew this was in relation to `Triangle` because we were just working with it, but what if a bug slipped in to the system in one of 20 cases in the table? How would a developer know which case failed? This is not a great experience for the developer, they will have to manually look through the cases to find out which case actually failed.

We can change our error message `%#v got %.2f want %.2f`. `%#v` format string will print out our struct with the values in it's field, so the developer can see at a glance the properties that are being tested.
We can change our error message `%#v got %.2f want %.2f`. `%#v` format string will print out our struct with the values in its field, so the developer can see at a glance the properties that are being tested.

To increase the readability of our test cases further we can rename the `want` field into something more descriptive like `hasArea`.

Expand Down

0 comments on commit 8ccca2e

Please sign in to comment.