diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 850d3bf9d..12fe6536f 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -99,7 +99,7 @@ func TestAccept(t *testing.T) { testName := strings.ReplaceAll(dir, "\\", "/") t.Run(testName, func(t *testing.T) { t.Parallel() - runTest(t, dir, coverDir, repls) + runTest(t, dir, coverDir, repls.Clone()) }) } } diff --git a/libs/testdiff/replacement.go b/libs/testdiff/replacement.go index 1ab976109..207f425aa 100644 --- a/libs/testdiff/replacement.go +++ b/libs/testdiff/replacement.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "regexp" + "slices" "strings" "github.com/databricks/cli/internal/testutil" @@ -31,6 +32,10 @@ type ReplacementsContext struct { Repls []Replacement } +func (r *ReplacementsContext) Clone() ReplacementsContext { + return ReplacementsContext{Repls: slices.Clone(r.Repls)} +} + func (r *ReplacementsContext) Replace(s string) string { // QQQ Should probably only replace whole words for _, repl := range r.Repls {