December 2021
Intermediate to advanced
510 pages
11h 20m
English
You’ve structured your code so you can add more steps to the pipeline by instantiating a new step and adding it to the pipeline slice. According to the initial plan, the next step in the pipeline is the execution of tests using the go test command. But before you add that step, add a test file with a single test case to the add package you’re using for testing.
Switch to the subdirectory testdata/tool, where you have the file add.go:
| | $ cd testdata/tool |
In this subdirectory, create the test file add_test.go, and add a single test case to test the add function:
| | package add |
| | |
| | import ( |
| | "testing" |
| | ) |
| | |
| | func TestAdd(t *testing.T) { |
| | a := 2 |
| | b := 3 ... |
Read now
Unlock full access