summaryrefslogtreecommitdiff
path: root/android/selects_test.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2024-11-21 11:20:06 -0800
committer Cole Faust <colefaust@google.com> 2024-11-21 11:20:06 -0800
commit4143ee8197c30f58c7e30da79a2f570953e9232d (patch)
treeb5b8643ce77cf557a6a40222dffbfb95993a352e /android/selects_test.go
parente00f2462ca76d15cabb7f43e7bb01c14688ce10c (diff)
Add support for selects on string lists
Bug: 375341427 Test: m nothing --no-skip-soong-tests Change-Id: I6ecab80f054e8594dacbeaaa33714b2f55af16b5
Diffstat (limited to 'android/selects_test.go')
-rw-r--r--android/selects_test.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/android/selects_test.go b/android/selects_test.go
index 90d7091e0..1397ed8b7 100644
--- a/android/selects_test.go
+++ b/android/selects_test.go
@@ -1031,6 +1031,54 @@ my_module_type {
my_string_list: &[]string{"d2", "e2", "f2", "a1", "b1", "c1"},
},
},
+ {
+ name: "string list variables",
+ bp: `
+my_module_type {
+ name: "foo",
+ my_string_list: ["a"] + select(soong_config_variable("my_namespace", "my_var"), {
+ any @ my_var: my_var,
+ default: [],
+ }),
+}
+`,
+ vendorVars: map[string]map[string]string{
+ "my_namespace": {
+ "my_var": "b c",
+ },
+ },
+ vendorVarTypes: map[string]map[string]string{
+ "my_namespace": {
+ "my_var": "string_list",
+ },
+ },
+ provider: selectsTestProvider{
+ my_string_list: &[]string{"a", "b", "c"},
+ },
+ },
+ {
+ name: "string list variables don't match string matchers",
+ bp: `
+my_module_type {
+ name: "foo",
+ my_string_list: ["a"] + select(soong_config_variable("my_namespace", "my_var"), {
+ "foo": ["b"],
+ default: [],
+ }),
+}
+`,
+ vendorVars: map[string]map[string]string{
+ "my_namespace": {
+ "my_var": "b c",
+ },
+ },
+ vendorVarTypes: map[string]map[string]string{
+ "my_namespace": {
+ "my_var": "string_list",
+ },
+ },
+ expectedError: `Expected all branches of a select on condition soong_config_variable\("my_namespace", "my_var"\) to have type string_list, found string`,
+ },
}
for _, tc := range testCases {