summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2024-06-13 15:35:17 -0700
committer Cole Faust <colefaust@google.com> 2024-06-13 15:35:17 -0700
commitfee6fdea22e3c282ca95c644130ff07d450e4f3a (patch)
tree6a44936a199d86f277f30f78d3ec4e216532c8a6
parente96c16a806053d7db9b1de164f7dba8e499e4a44 (diff)
Add test for AppendSimpleValue
Bug: 346922064 Test: m nothing --no-skip-soong-tests Change-Id: I18d82cf5ca20b1c9fea9751fee742577b5173374
-rw-r--r--android/selects_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/android/selects_test.go b/android/selects_test.go
index 6f980ce4c..3093deb11 100644
--- a/android/selects_test.go
+++ b/android/selects_test.go
@@ -778,6 +778,27 @@ func TestSelects(t *testing.T) {
my_string_list: &[]string{"a.cpp", "b.cpp", "c.cpp"},
},
},
+ {
+ name: "Test AppendSimpleValue",
+ bp: `
+ my_module_type {
+ name: "foo",
+ my_string_list: ["a.cpp"] + select(soong_config_variable("my_namespace", "my_variable"), {
+ "a": ["a.cpp"],
+ "b": ["b.cpp"],
+ default: ["c.cpp"],
+ }),
+ }
+ `,
+ vendorVars: map[string]map[string]string{
+ "selects_test": {
+ "append_to_string_list": "foo.cpp",
+ },
+ },
+ provider: selectsTestProvider{
+ my_string_list: &[]string{"a.cpp", "c.cpp", "foo.cpp"},
+ },
+ },
}
for _, tc := range testCases {
@@ -892,6 +913,10 @@ func optionalToPtr[T any](o proptools.ConfigurableOptional[T]) *T {
}
func (p *selectsMockModule) GenerateAndroidBuildActions(ctx ModuleContext) {
+ toAppend := ctx.Config().VendorConfig("selects_test").String("append_to_string_list")
+ if toAppend != "" {
+ p.properties.My_string_list.AppendSimpleValue([]string{toAppend})
+ }
SetProvider(ctx, selectsTestProviderKey, selectsTestProvider{
my_bool: optionalToPtr(p.properties.My_bool.Get(ctx)),
my_string: optionalToPtr(p.properties.My_string.Get(ctx)),