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
This commit is contained in:
@@ -228,9 +228,6 @@ func NewFixtureFactory(buildDirSupplier *string, preparers ...FixturePreparer) F
|
|||||||
return &fixtureFactory{
|
return &fixtureFactory{
|
||||||
buildDirSupplier: buildDirSupplier,
|
buildDirSupplier: buildDirSupplier,
|
||||||
preparers: dedupAndFlattenPreparers(nil, preparers),
|
preparers: dedupAndFlattenPreparers(nil, preparers),
|
||||||
|
|
||||||
// Set the default error handler.
|
|
||||||
errorHandler: FixtureExpectsNoErrors,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +644,6 @@ var _ FixtureFactory = (*fixtureFactory)(nil)
|
|||||||
type fixtureFactory struct {
|
type fixtureFactory struct {
|
||||||
buildDirSupplier *string
|
buildDirSupplier *string
|
||||||
preparers []*simpleFixturePreparer
|
preparers []*simpleFixturePreparer
|
||||||
errorHandler FixtureErrorHandler
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fixtureFactory) Extend(preparers ...FixturePreparer) FixtureFactory {
|
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)
|
config := TestConfig(buildDir, nil, "", nil)
|
||||||
ctx := NewTestContext(config)
|
ctx := NewTestContext(config)
|
||||||
fixture := &fixture{
|
fixture := &fixture{
|
||||||
preparers: all,
|
preparers: all,
|
||||||
t: t,
|
t: t,
|
||||||
config: config,
|
config: config,
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
mockFS: make(MockFS),
|
mockFS: make(MockFS),
|
||||||
errorHandler: f.errorHandler,
|
// Set the default error handler.
|
||||||
|
errorHandler: FixtureExpectsNoErrors,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, preparer := range all {
|
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 {
|
func (f *fixtureFactory) ExtendWithErrorHandler(errorHandler FixtureErrorHandler) FixtureFactory {
|
||||||
newFactory := &fixtureFactory{}
|
return f.Extend(newSimpleFixturePreparer(func(fixture *fixture) {
|
||||||
*newFactory = *f
|
fixture.errorHandler = errorHandler
|
||||||
newFactory.errorHandler = errorHandler
|
}))
|
||||||
return newFactory
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fixtureFactory) RunTest(t *testing.T, preparers ...FixturePreparer) *TestResult {
|
func (f *fixtureFactory) RunTest(t *testing.T, preparers ...FixturePreparer) *TestResult {
|
||||||
|
Reference in New Issue
Block a user