Skip to content

Commit 9dc8444

Browse files
committed
robot-name: Add hints.md file (exercism#858)
This describes the bonus test and how to run it. closes exercism#832
1 parent a77af30 commit 9dc8444

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Bonus exercise
2+
3+
Once you get `go test` passing, try `go test -tags bonus`. This uses a *build
4+
tag* to enable a test that wasn't previously enabled. Build tags control which
5+
files should be included in the package. You can read more about those at [the
6+
Go documentation](https://golang.org/pkg/go/build/#hdr-Build_Constraints).
7+
8+
For this exercise it limits `go test` to only build the tests in the
9+
`robot_name_test.go` file. We can then include the bonus test in the
10+
`bonus_test.go` file with the tags flag as described above.
11+
12+
To get the bonus test to pass you'll have to ensure a robot's name has not been
13+
used before.

exercises/robot-name/bonus_example.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"math/rand"
88
)
99

10+
const testVersion = 1
11+
1012
type Robot struct {
1113
name string
1214
}

0 commit comments

Comments
 (0)