diff options
| author | 2019-10-21 14:29:58 +0100 | |
|---|---|---|
| committer | 2019-10-21 14:36:41 +0100 | |
| commit | bdf5d7170ac859e28f458c1d46c2b2494061de3f (patch) | |
| tree | 83ad7a3432fa04d4b6178f4cac954eb34f2e41f9 /java/java_test.go | |
| parent | 8436ccea9c591b8c312555ff468c003c2d73f266 (diff) | |
Refactor and strengthen sdk_test.go.
This change:
- Removes usage of the EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false option
from tests, since it is going to be removed. The java_version
property is used instead.
- Commons up some of the assertions between the tests for language
levels 8 and 9 in sdk_test.go.
- In commoning the code up, some additional assertions are made in the
language level 9 cases, strengthening the tests.
Test: m nothing
Bug: 115604102
Change-Id: I693c5d299b5592b851c44dde4434d92a931f15cd
Diffstat (limited to 'java/java_test.go')
| -rw-r--r-- | java/java_test.go | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/java/java_test.go b/java/java_test.go index a3499ccd8..3767d1b24 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -1073,32 +1073,32 @@ func checkPatchModuleFlag(t *testing.T, ctx *android.TestContext, moduleName str } func TestPatchModule(t *testing.T) { - bp := ` - java_library { - name: "foo", - srcs: ["a.java"], - } - - java_library { - name: "bar", - srcs: ["b.java"], - sdk_version: "none", - system_modules: "none", - patch_module: "java.base", - } - - java_library { - name: "baz", - srcs: ["c.java"], - patch_module: "java.base", - } - ` - t.Run("Java language level 8", func(t *testing.T) { // Test with legacy javac -source 1.8 -target 1.8 - config := testConfig(map[string]string{"EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9": "false"}) - ctx := testContext(bp, nil) - run(t, ctx, config) + bp := ` + java_library { + name: "foo", + srcs: ["a.java"], + java_version: "1.8", + } + + java_library { + name: "bar", + srcs: ["b.java"], + sdk_version: "none", + system_modules: "none", + patch_module: "java.base", + java_version: "1.8", + } + + java_library { + name: "baz", + srcs: ["c.java"], + patch_module: "java.base", + java_version: "1.8", + } + ` + ctx, _ := testJava(t, bp) checkPatchModuleFlag(t, ctx, "foo", "") checkPatchModuleFlag(t, ctx, "bar", "") @@ -1107,6 +1107,26 @@ func TestPatchModule(t *testing.T) { t.Run("Java language level 9", func(t *testing.T) { // Test with default javac -source 9 -target 9 + bp := ` + java_library { + name: "foo", + srcs: ["a.java"], + } + + java_library { + name: "bar", + srcs: ["b.java"], + sdk_version: "none", + system_modules: "none", + patch_module: "java.base", + } + + java_library { + name: "baz", + srcs: ["c.java"], + patch_module: "java.base", + } + ` ctx, _ := testJava(t, bp) checkPatchModuleFlag(t, ctx, "foo", "") |