summaryrefslogtreecommitdiff
path: root/android/soongconfig/modules_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-01-04 14:47:45 -0800
committer Colin Cross <ccross@android.com> 2024-01-05 09:54:09 -0800
commit3cc3154d33265d956bb1036d1e9a569cf3eb8d4a (patch)
tree211a6495af9f6e1f680b5806d75f3ee8c6cdfd3f /android/soongconfig/modules_test.go
parentd3f7d1a44c2ea75072197b0e610c07216ba92ae2 (diff)
Remove more bp2build
Bug: 315353489 Test: m blueprint_tests Change-Id: Ib854fe1a448c258fe086691a6e5ed2d98537f5e4
Diffstat (limited to 'android/soongconfig/modules_test.go')
-rw-r--r--android/soongconfig/modules_test.go217
1 files changed, 0 insertions, 217 deletions
diff --git a/android/soongconfig/modules_test.go b/android/soongconfig/modules_test.go
index a5fa34938..00e8b785a 100644
--- a/android/soongconfig/modules_test.go
+++ b/android/soongconfig/modules_test.go
@@ -413,220 +413,3 @@ func Test_PropertiesToApply_String_Error(t *testing.T) {
t.Fatalf("Error message was not correct, expected %q, got %q", expected, err.Error())
}
}
-
-func Test_Bp2BuildSoongConfigDefinitionsAddVars(t *testing.T) {
- testCases := []struct {
- desc string
- defs []*SoongConfigDefinition
- expected Bp2BuildSoongConfigDefinitions
- }{
- {
- desc: "non-overlapping",
- defs: []*SoongConfigDefinition{
- &SoongConfigDefinition{
- ModuleTypes: map[string]*ModuleType{
- "a": &ModuleType{
- ConfigNamespace: "foo",
- Variables: []soongConfigVariable{
- &stringVariable{
- baseVariable: baseVariable{"string_var"},
- values: []string{"a", "b", "c"},
- },
- },
- },
- },
- },
- &SoongConfigDefinition{
- ModuleTypes: map[string]*ModuleType{
- "b": &ModuleType{
- ConfigNamespace: "foo",
- Variables: []soongConfigVariable{
- &stringVariable{
- baseVariable: baseVariable{"string_var"},
- values: []string{"a", "b", "c"},
- },
- &boolVariable{baseVariable: baseVariable{"bool_var"}},
- &valueVariable{baseVariable: baseVariable{"variable_var"}},
- },
- },
- },
- },
- },
- expected: Bp2BuildSoongConfigDefinitions{
- StringVars: map[string]map[string]bool{
- "foo__string_var": map[string]bool{"a": true, "b": true, "c": true},
- },
- BoolVars: map[string]bool{"foo__bool_var": true},
- ValueVars: map[string]bool{"foo__variable_var": true},
- },
- },
- {
- desc: "overlapping",
- defs: []*SoongConfigDefinition{
- &SoongConfigDefinition{
- ModuleTypes: map[string]*ModuleType{
- "a": &ModuleType{
- ConfigNamespace: "foo",
- Variables: []soongConfigVariable{
- &stringVariable{
- baseVariable: baseVariable{"string_var"},
- values: []string{"a", "b", "c"},
- },
- },
- },
- },
- },
- &SoongConfigDefinition{
- ModuleTypes: map[string]*ModuleType{
- "b": &ModuleType{
- ConfigNamespace: "foo",
- Variables: []soongConfigVariable{
- &stringVariable{
- baseVariable: baseVariable{"string_var"},
- values: []string{"b", "c", "d"},
- },
- &boolVariable{baseVariable: baseVariable{"bool_var"}},
- &valueVariable{baseVariable: baseVariable{"variable_var"}},
- },
- },
- },
- },
- },
- expected: Bp2BuildSoongConfigDefinitions{
- StringVars: map[string]map[string]bool{
- "foo__string_var": map[string]bool{"a": true, "b": true, "c": true, "d": true},
- },
- BoolVars: map[string]bool{"foo__bool_var": true},
- ValueVars: map[string]bool{"foo__variable_var": true},
- },
- },
- }
-
- for _, tc := range testCases {
- t.Run(tc.desc, func(t *testing.T) {
- actual := &Bp2BuildSoongConfigDefinitions{}
- for _, d := range tc.defs {
- func(def *SoongConfigDefinition) {
- actual.AddVars(def)
- }(d)
- }
- if !reflect.DeepEqual(*actual, tc.expected) {
- t.Errorf("Expected %#v, got %#v", tc.expected, *actual)
- }
- })
- }
-
-}
-
-func Test_Bp2BuildSoongConfigDefinitions(t *testing.T) {
- testCases := []struct {
- desc string
- defs Bp2BuildSoongConfigDefinitions
- expected string
- }{
- {
- desc: "all empty",
- defs: Bp2BuildSoongConfigDefinitions{},
- expected: `soong_config_bool_variables = {}
-
-soong_config_value_variables = {}
-
-soong_config_string_variables = {}`}, {
- desc: "only bool",
- defs: Bp2BuildSoongConfigDefinitions{
- BoolVars: map[string]bool{
- "bool_var": true,
- },
- },
- expected: `soong_config_bool_variables = {
- "bool_var": True,
-}
-
-soong_config_value_variables = {}
-
-soong_config_string_variables = {}`}, {
- desc: "only value vars",
- defs: Bp2BuildSoongConfigDefinitions{
- ValueVars: map[string]bool{
- "value_var": true,
- },
- },
- expected: `soong_config_bool_variables = {}
-
-soong_config_value_variables = {
- "value_var": True,
-}
-
-soong_config_string_variables = {}`}, {
- desc: "only string vars",
- defs: Bp2BuildSoongConfigDefinitions{
- StringVars: map[string]map[string]bool{
- "string_var": map[string]bool{
- "choice1": true,
- "choice2": true,
- "choice3": true,
- },
- },
- },
- expected: `soong_config_bool_variables = {}
-
-soong_config_value_variables = {}
-
-soong_config_string_variables = {
- "string_var": [
- "choice1",
- "choice2",
- "choice3",
- ],
-}`}, {
- desc: "all vars",
- defs: Bp2BuildSoongConfigDefinitions{
- BoolVars: map[string]bool{
- "bool_var_one": true,
- },
- ValueVars: map[string]bool{
- "value_var_one": true,
- "value_var_two": true,
- },
- StringVars: map[string]map[string]bool{
- "string_var_one": map[string]bool{
- "choice1": true,
- "choice2": true,
- "choice3": true,
- },
- "string_var_two": map[string]bool{
- "foo": true,
- "bar": true,
- },
- },
- },
- expected: `soong_config_bool_variables = {
- "bool_var_one": True,
-}
-
-soong_config_value_variables = {
- "value_var_one": True,
- "value_var_two": True,
-}
-
-soong_config_string_variables = {
- "string_var_one": [
- "choice1",
- "choice2",
- "choice3",
- ],
- "string_var_two": [
- "bar",
- "foo",
- ],
-}`},
- }
- for _, test := range testCases {
- t.Run(test.desc, func(t *testing.T) {
- actual := test.defs.String()
- if actual != test.expected {
- t.Errorf("Expected:\n%s\nbut got:\n%s", test.expected, actual)
- }
- })
- }
-}