Make TestContext.RegisterModuleType take an android.ModuleFactory

Avoid having to pass ModuleFactoryAdaptor to every call to
RegisterModuleType in a test by wrapping RegisterModuleType.

Test: all soong tests
Change-Id: If8847d16487de0479cc3020b728256922b3cadba
This commit is contained in:
Colin Cross
2019-11-22 15:25:03 -08:00
parent 62835fd85f
commit 4b49b768a2
33 changed files with 204 additions and 201 deletions

View File

@@ -159,17 +159,17 @@ func testProductVariableModuleFactoryFactory(props interface{}) func() Module {
func TestProductVariables(t *testing.T) {
ctx := NewTestContext()
// A module type that has a srcs property but not a cflags property.
ctx.RegisterModuleType("module1", ModuleFactoryAdaptor(testProductVariableModuleFactoryFactory(struct {
ctx.RegisterModuleType("module1", testProductVariableModuleFactoryFactory(struct {
Srcs []string
}{})))
}{}))
// A module type that has a cflags property but not a srcs property.
ctx.RegisterModuleType("module2", ModuleFactoryAdaptor(testProductVariableModuleFactoryFactory(struct {
ctx.RegisterModuleType("module2", testProductVariableModuleFactoryFactory(struct {
Cflags []string
}{})))
}{}))
// A module type that does not have any properties that match product_variables.
ctx.RegisterModuleType("module3", ModuleFactoryAdaptor(testProductVariableModuleFactoryFactory(struct {
ctx.RegisterModuleType("module3", testProductVariableModuleFactoryFactory(struct {
Foo []string
}{})))
}{}))
ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
ctx.BottomUp("variable", variableMutator).Parallel()
})