Commit 55b4c85

mo khan <mo.khan@gmail.com>
2019-10-23 02:11:39
start test to specify times
1 parent 5c49c84
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) {