Remove errorHandler from FixtureFactory am: cff464f794

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647192

Change-Id: If8cacd24e66108952219597026c0391b660bc3e9
This commit is contained in:
Paul Duffin
2021-03-22 19:29:08 +00:00
committed by Automerger Merge Worker

View File

@@ -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 {
@@ -679,12 +675,13 @@ func (f *fixtureFactory) Fixture(t *testing.T, preparers ...FixturePreparer) Fix
config := TestConfig(buildDir, nil, "", nil)
ctx := NewTestContext(config)
fixture := &fixture{
preparers: all,
t: t,
config: config,
ctx: ctx,
mockFS: make(MockFS),
errorHandler: f.errorHandler,
preparers: all,
t: t,
config: config,
ctx: ctx,
mockFS: make(MockFS),
// 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 {