diff options
Diffstat (limited to 'java/testing.go')
-rw-r--r-- | java/testing.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/java/testing.go b/java/testing.go index f5688e627..94f054e67 100644 --- a/java/testing.go +++ b/java/testing.go @@ -16,9 +16,13 @@ package java import ( "fmt" + "reflect" + "sort" + "testing" "android/soong/android" "android/soong/cc" + "github.com/google/blueprint" ) func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) android.Config { @@ -216,3 +220,17 @@ func GatherRequiredDepsForTest() string { return bp } + +func CheckModuleDependencies(t *testing.T, ctx *android.TestContext, name, variant string, expected []string) { + t.Helper() + module := ctx.ModuleForTests(name, variant).Module() + deps := []string{} + ctx.VisitDirectDeps(module, func(m blueprint.Module) { + deps = append(deps, m.Name()) + }) + sort.Strings(deps) + + if actual := deps; !reflect.DeepEqual(expected, actual) { + t.Errorf("expected %#q, found %#q", expected, actual) + } +} |