Iteration
Write the test first
package iteration
import "testing"
func TestRepeat(t *testing.T) {
repeated := Repeat("a")
expected := "aaaaa"
if repeated != expected {
t.Errorf("expected %q but got %q", expected, repeated)
}
}Try and run the test
Write the minimal amount of code for the test to run and check the failing test output
Write enough code to make it pass
Refactor
Benchmarking
Practice exercises
Wrapping up
Last updated