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

Commit cff464f7 authored by Paul Duffin's avatar Paul Duffin
Browse files

Remove errorHandler from FixtureFactory

The ExtendWithErrorHandler method simply wraps the FixtureErrorHandler
in a FixturePreparer that will set the error handler in the fixture.

Bug: 183235980
Test: m nothing

Change-Id: Icf9a5f62cb532efc120300c2f906cd3397aa6763
parent 59251829
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -228,9 +228,6 @@ func NewFixtureFactory(buildDirSupplier *string, preparers ...FixturePreparer) F
	return &fixtureFactory{
		buildDirSupplier: buildDirSupplier,
		preparers:        dedupAndFlattenPreparers(nil, preparers),

		// Set the default error handler.
		errorHandler: FixtureExpectsNoErrors,
	}
}

@@ -647,7 +644,6 @@ var _ FixtureFactory = (*fixtureFactory)(nil)
type fixtureFactory struct {
	buildDirSupplier *string
	preparers        []*simpleFixturePreparer
	errorHandler     FixtureErrorHandler
}

func (f *fixtureFactory) Extend(preparers ...FixturePreparer) FixtureFactory {
@@ -684,7 +680,8 @@ func (f *fixtureFactory) Fixture(t *testing.T, preparers ...FixturePreparer) Fix
		config:    config,
		ctx:       ctx,
		mockFS:    make(MockFS),
		errorHandler: f.errorHandler,
		// Set the default error handler.
		errorHandler: FixtureExpectsNoErrors,
	}

	for _, preparer := range all {
@@ -695,10 +692,9 @@ func (f *fixtureFactory) Fixture(t *testing.T, preparers ...FixturePreparer) Fix
}

func (f *fixtureFactory) ExtendWithErrorHandler(errorHandler FixtureErrorHandler) FixtureFactory {
	newFactory := &fixtureFactory{}
	*newFactory = *f
	newFactory.errorHandler = errorHandler
	return newFactory
	return f.Extend(newSimpleFixturePreparer(func(fixture *fixture) {
		fixture.errorHandler = errorHandler
	}))
}

func (f *fixtureFactory) RunTest(t *testing.T, preparers ...FixturePreparer) *TestResult {