Remove FixturePreparer.Extend()

Use GroupFixturePreparers instead.

Bug: 182885307
Test: m nothing
Change-Id: Idc01d3cc5a57576a4cf417e9105d1ab851126e10
This commit is contained in:
Paul Duffin
2021-03-29 02:16:14 +01:00
parent 4814bb814a
commit 79abe57f53
6 changed files with 28 additions and 30 deletions

View File

@@ -367,15 +367,6 @@ type FixturePreparer interface {
// Return the flattened and deduped list of simpleFixturePreparer pointers.
list() []*simpleFixturePreparer
// Creates a copy of this instance and adds some additional preparers.
//
// Before the preparers are used they are combined with the current preparer, any groups of
// preparers are flattened, and the list is deduped so that each preparer is only used once. See
// the file documentation in android/fixture.go for more details.
//
// deprecated: Use GroupFixturePreparers() instead.
Extend(preparers ...FixturePreparer) FixturePreparer
// Create a Fixture.
Fixture(t *testing.T) Fixture
@@ -656,17 +647,12 @@ func (b *baseFixturePreparer) initBaseFixturePreparer(self FixturePreparer) {
b.self = self
}
func (b *baseFixturePreparer) Extend(preparers ...FixturePreparer) FixturePreparer {
all := dedupAndFlattenPreparers(b.self.list(), preparers)
return newFixturePreparer(all)
}
func (b *baseFixturePreparer) Fixture(t *testing.T) Fixture {
return createFixture(t, t.TempDir(), b.self.list())
}
func (b *baseFixturePreparer) ExtendWithErrorHandler(errorHandler FixtureErrorHandler) FixturePreparer {
return b.self.Extend(newSimpleFixturePreparer(func(fixture *fixture) {
return GroupFixturePreparers(b.self, newSimpleFixturePreparer(func(fixture *fixture) {
fixture.errorHandler = errorHandler
}))
}