Skip to content

Commit 9ac6003

Browse files
authored
Update integers.md (quii#343)
1 parent 03de656 commit 9ac6003

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

integers.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
**[You can find all the code for this chapter here](https://github.com/quii/learn-go-with-tests/tree/master/integers)**
44

5-
Integers work as you would expect. Let's write an add function to try things out. Create a test file called `adder_test.go` and write this code.
5+
Integers work as you would expect. Let's write an `Add` function to try things out. Create a test file called `adder_test.go` and write this code.
66

7-
**note:** Go source files can only have one `package` per directory, make sure that your files are organised separately. [Here is a good explanation on this.](https://dave.cheney.net/2014/12/01/five-suggestions-for-setting-up-a-go-project)
7+
**Note:** Go source files can only have one `package` per directory, make sure that your files are organised separately. [Here is a good explanation on this.](https://dave.cheney.net/2014/12/01/five-suggestions-for-setting-up-a-go-project)
88

99
## Write the test first
1010

@@ -25,7 +25,7 @@ func TestAdder(t *testing.T) {
2525

2626
You will notice that we're using `%d` as our format strings rather than `%q`. That's because we want it to print an integer rather than a string.
2727

28-
Also note that we are no longer using the main package, instead we've defined a package named integers, as the name suggests this will group functions for working with integers such as Add.
28+
Also note that we are no longer using the main package, instead we've defined a package named `integers`, as the name suggests this will group functions for working with integers such as `Add`.
2929

3030
## Try and run the test
3131

@@ -67,9 +67,9 @@ func Add(x, y int) int {
6767

6868
Ah hah! Foiled again, TDD is a sham right?
6969

70-
We could write another test, with some different numbers to force that test to fail but that feels like a game of cat and mouse.
70+
We could write another test, with some different numbers to force that test to fail but that feels like [a game of cat and mouse](https://en.m.wikipedia.org/wiki/Cat_and_mouse).
7171

72-
Once we're more familiar with Go's syntax I will introduce a technique called Property Based Testing, which would stop annoying developers and help you find bugs.
72+
Once we're more familiar with Go's syntax I will introduce a technique called *"Property Based Testing"*, which would stop annoying developers and help you find bugs.
7373

7474
For now, let's fix it properly
7575

@@ -108,7 +108,7 @@ Go examples are executed just like tests so you can be confident examples reflec
108108

109109
Examples are compiled \(and optionally executed\) as part of a package's test suite.
110110

111-
As with typical tests, examples are functions that reside in a package's \_test.go files. Add the following ExampleAdd function to the `adder_test.go` file.
111+
As with typical tests, examples are functions that reside in a package's `_test.go` files. Add the following `ExampleAdd` function to the `adder_test.go` file.
112112

113113
```go
114114
func ExampleAdd() {
@@ -132,7 +132,7 @@ $ go test -v
132132
--- PASS: ExampleAdd (0.00s)
133133
```
134134

135-
Please note that the example function will not be executed if you remove the comment "//Output: 6". Although the function will be compiled, it won't be executed.
135+
Please note that the example function will not be executed if you remove the comment `//Output: 6`. Although the function will be compiled, it won't be executed.
136136

137137
By adding this code the example will appear in the documentation inside `godoc`, making your code even more accessible.
138138

0 commit comments

Comments
 (0)