Skip to content

Commit

Permalink
fixes #759
Browse files Browse the repository at this point in the history
  • Loading branch information
quii committed Jun 21, 2024
1 parent a61ff58 commit ce1a6ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ For helper functions, it's a good idea to accept a `testing.TB` which is an inte

`t.Helper()` is needed to tell the test suite that this method is a helper. By doing this, when it fails, the line number reported will be in our _function call_ rather than inside our test helper. This will help other developers track down problems more easily. If you still don't understand, comment it out, make a test fail and observe the test output. Comments in Go are a great way to add additional information to your code, or in this case, a quick way to tell the compiler to ignore a line. You can comment out the `t.Helper()` code by adding two forward slashes `//` at the beginning of the line. You should see that line turn grey or change to another color than the rest of your code to indicate it's now commented out.

When you have more than one argument of the same type \(in our case two strings\) rather than having `(got string, want string)` you can shorten it to `(got, want string)`.

### Back to source control

Now that we are happy with the code, I would amend the previous commit so that we only check in the lovely version of our code with its test.
Expand Down
4 changes: 2 additions & 2 deletions integers.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ func Add(x, y int) int {
}
```

When you have more than one argument of the same type \(in our case two integers\) rather than having `(x int, y int)` you can shorten it to `(x, y int)`.
Remember, when you have more than one argument of the same type \(in our case two integers\) rather than having `(x int, y int)` you can shorten it to `(x, y int)`.

Now run the tests and we should be happy that the test is correctly reporting what is wrong.
Now run the tests, and we should be happy that the test is correctly reporting what is wrong.

`adder_test.go:10: expected '4' but got '0'`

Expand Down
2 changes: 1 addition & 1 deletion maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ func TestDelete(t *testing.T) {
dictionary.Delete(word)

_, err := dictionary.Search(word)
assertError(t, word, ErrNotFound)
assertError(t, word, ErrNotFound)

This comment has been minimized.

Copy link
@mauriciobenjamin

mauriciobenjamin Jun 23, 2024

word variable is useless for this function. And err variable is not used. In the source code of this chapter the correct syntax is assertError(t, err, ErrNotFound).

}
```

Expand Down

0 comments on commit ce1a6ed

Please sign in to comment.