Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71606990 authored by Paul Duffin's avatar Paul Duffin Committed by Gerrit Code Review
Browse files

Merge "Avoid accidentally sharing preparers slice across factories"

parents acb7aeb9 fa298853
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -564,7 +564,11 @@ type fixtureFactory struct {
}

func (f *fixtureFactory) Extend(preparers ...FixturePreparer) FixtureFactory {
	all := append(f.preparers, dedupAndFlattenPreparers(f.preparers, preparers)...)
	// Create a new slice to avoid accidentally sharing the preparers slice from this factory with
	// the extending factories.
	var all []*simpleFixturePreparer
	all = append(all, f.preparers...)
	all = append(all, dedupAndFlattenPreparers(f.preparers, preparers)...)
	// Copy the existing factory.
	extendedFactory := &fixtureFactory{}
	*extendedFactory = *f