diff options
author | 2021-10-28 18:05:53 +0100 | |
---|---|---|
committer | 2021-10-29 17:57:12 +0100 | |
commit | 0b3b36a4027a7456f765b85fd819a4d26ed50795 (patch) | |
tree | 5ec4f1038b2bd04fffddc7e49d5c1251880ab5af /java/sdk_test.go | |
parent | 12e311d95838051b5dd2cc2a963d9ff0cb5d7273 (diff) |
Refactor TestClasspath to simplify follow up change
Extracts classpathTestCase and extracts the logic for creating the test
into a separate testClasspathTestCases func.
Bug: 204189791
Test: m nothing
Change-Id: I657fbcde23a18f7f5651c174fbf17a9b7b7f1a9a
Diffstat (limited to 'java/sdk_test.go')
-rw-r--r-- | java/sdk_test.go | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/java/sdk_test.go b/java/sdk_test.go index 28b962432..ed874e543 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -25,27 +25,29 @@ import ( "android/soong/java/config" ) -func TestClasspath(t *testing.T) { - const frameworkAidl = "-I" + defaultJavaDir + "/framework/aidl" - var classpathTestcases = []struct { - name string - unbundled bool - moduleType string - host android.OsClass - properties string +type classpathTestCase struct { + name string + unbundled bool + moduleType string + host android.OsClass + properties string - // for java 8 - bootclasspath []string - java8classpath []string + // for java 8 + bootclasspath []string + java8classpath []string - // for java 9 - system string - java9classpath []string + // for java 9 + system string + java9classpath []string - forces8 bool // if set, javac will always be called with java 8 arguments + forces8 bool // if set, javac will always be called with java 8 arguments + + aidl string +} - aidl string - }{ +func TestClasspath(t *testing.T) { + const frameworkAidl = "-I" + defaultJavaDir + "/framework/aidl" + var classpathTestcases = []classpathTestCase{ { name: "default", bootclasspath: config.StableCorePlatformBootclasspathLibraries, @@ -295,6 +297,10 @@ func TestClasspath(t *testing.T) { }, } + testClasspathTestCases(t, classpathTestcases) +} + +func testClasspathTestCases(t *testing.T, classpathTestcases []classpathTestCase) { for _, testcase := range classpathTestcases { t.Run(testcase.name, func(t *testing.T) { moduleType := "java_library" |