Skip to content

Commit 5cbf8da

Browse files
authored
Update structs-methods-and-interfaces.md (quii#372)
Update error message format string when print float type data to make it same like example given
1 parent 24b7b9a commit 5cbf8da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

structs-methods-and-interfaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ Remember earlier when we were implementing `Triangle` and we had the failing tes
532532

533533
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.
534534

535-
We can change our error message into `%#v got %.2f want %.2f`. The `%#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.
535+
We can change our error message into `%#v got %g want %g`. The `%#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.
536536

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

0 commit comments

Comments
 (0)