From 9c3ac96f1fcc64432ef28f21f86bc98bfd518647 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 3 Feb 2021 14:11:27 +0000 Subject: Detect empty apex in ConfiguredJarList Previously, ConfiguredJarList would accept an empty apex name, e.g. ":jar" which makes no sense as every apex has to have a non-empty name. This change makes an empty apex invalid. In order to improve the test coverage of the TestConfiguredJarList test this change also changes the implementation of CreateTestConfiguredJarList([]string) to marshal the supplied strings into a json list and then unmarshal into a ConfiguredJarList which more closely matches how it is used at runtime. Bug: 178361284 Test: m nothing Change-Id: I7dfec6b4cc1923aa99746e976da0393922ef0791 --- java/hiddenapi_singleton_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'java/hiddenapi_singleton_test.go') diff --git a/java/hiddenapi_singleton_test.go b/java/hiddenapi_singleton_test.go index 0f9ef5841..27f363e0c 100644 --- a/java/hiddenapi_singleton_test.go +++ b/java/hiddenapi_singleton_test.go @@ -65,7 +65,7 @@ func TestHiddenAPISingleton(t *testing.T) { srcs: ["a.java"], compile_dex: true, } - `, []string{":foo"}, nil) + `, []string{"platform:foo"}, nil) hiddenAPI := ctx.SingletonForTests("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi") @@ -82,7 +82,7 @@ func TestHiddenAPISingletonWithPrebuilt(t *testing.T) { jars: ["a.jar"], compile_dex: true, } - `, []string{":foo"}, nil) + `, []string{"platform:foo"}, nil) hiddenAPI := ctx.SingletonForTests("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi") @@ -106,7 +106,7 @@ func TestHiddenAPISingletonWithPrebuiltUseSource(t *testing.T) { compile_dex: true, prefer: false, } - `, []string{":foo"}, nil) + `, []string{"platform:foo"}, nil) hiddenAPI := ctx.SingletonForTests("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi") @@ -135,7 +135,7 @@ func TestHiddenAPISingletonWithPrebuiltOverrideSource(t *testing.T) { compile_dex: true, prefer: true, } - `, []string{":foo"}, nil) + `, []string{"platform:foo"}, nil) hiddenAPI := ctx.SingletonForTests("hiddenapi") hiddenapiRule := hiddenAPI.Rule("hiddenapi") @@ -236,7 +236,7 @@ func TestHiddenAPISingletonWithPrebuiltCsvFile(t *testing.T) { jars: ["a.jar"], compile_dex: true, } - `, []string{":foo"}, &prebuiltHiddenApiDir) + `, []string{"platform:foo"}, &prebuiltHiddenApiDir) expectedCpInput := prebuiltHiddenApiDir + "/hiddenapi-flags.csv" expectedCpOutput := buildDir + "/hiddenapi/hiddenapi-flags.csv" -- cgit v1.2.3-59-g8ed1b