diff options
author | 2020-01-10 17:12:18 +0000 | |
---|---|---|
committer | 2020-01-15 11:17:57 +0000 | |
commit | a7b9f42587d844e2e3f5d528d7b13ac3bac24090 (patch) | |
tree | 24f042888b49a5faff05234bd2078d948ecb4bac /java/java_test.go | |
parent | 814bebb8ea2f39a54d872a71c2a8d1d7f7d9903e (diff) |
Add basic test for java_system_modules
Bug: 142940300
Test: m nothing
Change-Id: I8855df0832f93e40d31e457191590458c274bb5c
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index 30a8ca682..5791619c1 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1227,3 +1227,37 @@ func TestPatchModule(t *testing.T) { checkPatchModuleFlag(t, ctx, "baz", expected) }) } + +func TestJavaSystemModules(t *testing.T) { + ctx, _ := testJava(t, ` + java_system_modules { + name: "system-modules", + libs: ["system-module1", "system-module2"], + } + java_library { + name: "system-module1", + srcs: ["a.java"], + sdk_version: "none", + system_modules: "none", + } + java_library { + name: "system-module2", + srcs: ["b.java"], + sdk_version: "none", + system_modules: "none", + } + `) + + // check the existence of the module + systemModules := ctx.ModuleForTests("system-modules", "android_common") + + cmd := systemModules.Rule("jarsTosystemModules") + + // make sure the command compiles against the supplied modules. + for _, module := range []string{"system-module1.jar", "system-module2.jar"} { + if !strings.Contains(cmd.Args["classpath"], module) { + t.Errorf("system modules classpath %v does not contain %q", cmd.Args["classpath"], + module) + } + } +} |