Convert TestApexPermittedPackagesRules to use test fixtures
Adds PrepareForTestWithNeverallowRules to make it easy to test neverallow rules. Avoid exporting any unnecessary neverallow related methods from the android package. Bug: 181070625 Test: m nothing Change-Id: Idfc6955cb23f1a4d1790be7879388154b03f3980
This commit is contained in:
@@ -292,7 +292,6 @@ var prepareForNeverAllowTest = GroupFixturePreparers(
|
||||
ctx.RegisterModuleType("java_library_host", newMockJavaLibraryModule)
|
||||
ctx.RegisterModuleType("java_device_for_host", newMockJavaLibraryModule)
|
||||
ctx.RegisterModuleType("makefile_goal", newMockMakefileGoalModule)
|
||||
ctx.PostDepsMutators(RegisterNeverallowMutator)
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -301,12 +300,7 @@ func TestNeverallow(t *testing.T) {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
GroupFixturePreparers(
|
||||
prepareForNeverAllowTest,
|
||||
FixtureModifyConfig(func(config Config) {
|
||||
// If the test has its own rules then use them instead of the default ones.
|
||||
if test.rules != nil {
|
||||
SetTestNeverallowRules(config, test.rules)
|
||||
}
|
||||
}),
|
||||
PrepareForTestWithNeverallowRules(test.rules),
|
||||
test.fs.AddToFixture(),
|
||||
).
|
||||
ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern(test.expectedErrors)).
|
||||
|
Reference in New Issue
Block a user