diff options
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index 845a03a4d..cf01f3368 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -15,6 +15,7 @@ package java import ( + "fmt" "io/ioutil" "os" "path/filepath" @@ -622,6 +623,35 @@ func assertDeepEquals(t *testing.T, message string, expected interface{}, actual } } +func TestPrebuiltStubsSources(t *testing.T) { + test := func(t *testing.T, sourcesPath string, expectedInputs []string) { + ctx, _ := testJavaWithFS(t, fmt.Sprintf(` +prebuilt_stubs_sources { + name: "stubs-source", + srcs: ["%s"], +}`, sourcesPath), map[string][]byte{ + "stubs/sources/pkg/A.java": nil, + "stubs/sources/pkg/B.java": nil, + }) + + zipSrc := ctx.ModuleForTests("stubs-source", "android_common").Rule("zip_src") + if expected, actual := expectedInputs, zipSrc.Inputs.Strings(); !reflect.DeepEqual(expected, actual) { + t.Errorf("mismatch of inputs to soong_zip: expected %q, actual %q", expected, actual) + } + } + + t.Run("empty/missing directory", func(t *testing.T) { + test(t, "empty-directory", []string{}) + }) + + t.Run("non-empty set of sources", func(t *testing.T) { + test(t, "stubs/sources", []string{ + "stubs/sources/pkg/A.java", + "stubs/sources/pkg/B.java", + }) + }) +} + func TestJavaSdkLibraryImport(t *testing.T) { ctx, _ := testJava(t, ` java_library { |