Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b3a5781 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add basic test for java_system_modules"

parents bb363086 a7b9f425
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -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)
		}
	}
}