Commit 55b4c85
Changed files (1)
repeat_test.go
@@ -3,12 +3,23 @@ package main
import "testing"
func TestRepeat(t *testing.T) {
- repeated := Repeat("a")
- expected := "aaaaa"
+ t.Run("default", func(t *testing.T) {
+ repeated := Repeat("a")
+ expected := "aaaaa"
- if repeated != expected {
- t.Errorf("expected %q but got %q", expected, repeated)
- }
+ if repeated != expected {
+ t.Errorf("expected %q but got %q", expected, repeated)
+ }
+ })
+
+ t.Run("custom interval", func(t *testing.T) {
+ repeated := Repeat("a", 10)
+ expected := "aaaaaaaaaa"
+
+ if repeated != expected {
+ t.Errorf("expected %q but got %q", expected, repeated)
+ }
+ })
}
func BenchmarkRepeat(b *testing.B) {