From 4aa54cfb6db67778c436649e33d686e520c89be8 Mon Sep 17 00:00:00 2001 From: renzo Date: Sun, 25 May 2025 10:23:07 +0200 Subject: [PATCH] suite: add support for -testify.c Repeat tests without rerunning Setup/TeardownSuite --- suite/suite.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/suite/suite.go b/suite/suite.go index a7ceba731..e00a31158 100644 --- a/suite/suite.go +++ b/suite/suite.go @@ -16,6 +16,7 @@ import ( ) var matchMethod = flag.String("testify.m", "", "regular expression to select tests of the testify suite to run") +var repeatItem = flag.Uint("testify.c", 1, "used to repeat each test multiple times without rerunning Setup/TearDownSuite") // Suite is a basic testing suite with methods for storing and // retrieving the current *testing.T context. @@ -192,7 +193,10 @@ func Run(t *testing.T, suite TestingSuite) { method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) }, } - tests = append(tests, test) + + for i := uint(0); i < *repeatItem; i++ { + tests = append(tests, test) + } } if len(tests) == 0 {