From b81dc0efd0ba49276e17d710e8cac09a95be28f5 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Thu, 9 May 2024 15:51:52 -0700 Subject: [PATCH] Add tests for unhandled select condition errors Bug: 323382414 Test: m nothing --no-skip-soong-tests Change-Id: Ic36545c2730216c514c1530ded35829966e974f0 --- android/selects_test.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/android/selects_test.go b/android/selects_test.go index d9499a500..56db4374a 100644 --- a/android/selects_test.go +++ b/android/selects_test.go @@ -545,6 +545,24 @@ func TestSelects(t *testing.T) { my_string: proptools.StringPtr("default"), }, }, + { + name: "Unhandled string value", + bp: ` + my_module_type { + name: "foo", + my_string: select(soong_config_variable("my_namespace", "my_variable"), { + "foo": "a", + "bar": "b", + }), + } + `, + vendorVars: map[string]map[string]string{ + "my_namespace": { + "my_variable": "baz", + }, + }, + expectedError: `my_string: soong_config_variable\("my_namespace", "my_variable"\) had value "baz", which was not handled by the select statement`, + }, { name: "Select on boolean", bp: ` @@ -596,7 +614,7 @@ func TestSelects(t *testing.T) { }), } `, - expectedError: "foo", + expectedError: `my_string: boolean_var_for_testing\(\) had value undefined, which was not handled by the select statement`, }, { name: "Select on boolean undefined with default",