Add test for selects with variables

I thought this might need extra parsing code to handle, but it appears
to work fine.

Bug: 323382414
Test: Presubmits
Change-Id: I4e8bf44a222427c34b2709a41aa5497984154d9d
This commit is contained in:
Cole Faust
2024-05-21 11:20:15 -07:00
parent e0d5ea1d7c
commit b9519094d9

View File

@@ -688,6 +688,29 @@ func TestSelects(t *testing.T) {
`,
expectedError: `can't assign select statement to non-configurable property "my_nonconfigurable_string_list"`,
},
{
name: "Select in variable",
bp: `
my_second_variable = ["after.cpp"]
my_variable = select(soong_config_variable("my_namespace", "my_variable"), {
"a": ["a.cpp"],
"b": ["b.cpp"],
default: ["c.cpp"],
}) + my_second_variable
my_module_type {
name: "foo",
my_string_list: ["before.cpp"] + my_variable,
}
`,
provider: selectsTestProvider{
my_string_list: &[]string{"before.cpp", "a.cpp", "after.cpp"},
},
vendorVars: map[string]map[string]string{
"my_namespace": {
"my_variable": "a",
},
},
},
}
for _, tc := range testCases {