Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9519094 authored by Cole Faust's avatar Cole Faust
Browse files

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
parent e0d5ea1d
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -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 {