diff options
Diffstat (limited to 'java/bootclasspath_fragment_test.go')
-rw-r--r-- | java/bootclasspath_fragment_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go index d3de675d8..2307ce02b 100644 --- a/java/bootclasspath_fragment_test.go +++ b/java/bootclasspath_fragment_test.go @@ -278,3 +278,42 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) { android.AssertPathsRelativeToTopEquals(t, "widest dex stubs jar", expectedWidestPaths, info.TransitiveStubDexJarsByScope.StubDexJarsForWidestAPIScope()) } + +func TestBootclasspathFragment_Test(t *testing.T) { + result := android.GroupFixturePreparers( + prepareForTestWithBootclasspathFragment, + PrepareForTestWithJavaSdkLibraryFiles, + FixtureWithLastReleaseApis("mysdklibrary"), + ).RunTestWithBp(t, ` + bootclasspath_fragment { + name: "myfragment", + contents: ["mysdklibrary"], + hidden_api: { + split_packages: [], + }, + } + + bootclasspath_fragment_test { + name: "a_test_fragment", + contents: ["mysdklibrary"], + hidden_api: { + split_packages: [], + }, + } + + + java_sdk_library { + name: "mysdklibrary", + srcs: ["a.java"], + shared_library: false, + public: {enabled: true}, + system: {enabled: true}, + } + `) + + fragment := result.Module("myfragment", "android_common").(*BootclasspathFragmentModule) + android.AssertBoolEquals(t, "not a test fragment", false, fragment.isTestFragment()) + + fragment = result.Module("a_test_fragment", "android_common").(*BootclasspathFragmentModule) + android.AssertBoolEquals(t, "is a test fragment by type", true, fragment.isTestFragment()) +} |