export common bp2build testing functions

bp2buildTestCase
attrNameToString
runBp2BuildTestCase
makeBazelTargetNoRestrictions

The testing framework defined in the bp2build package can only be used
from within the package because many common testing functions are
private to the package. This prevents modules defined in Soong
plugins (e.g. system/tools/aidl/build) from testing bp2build conversions.

Test: go test ./bp2build
Change-Id: Ia867081327c5181d04687b13c4550e68e6a11f86
diff --git a/bp2build/build_conversion_test.go b/bp2build/build_conversion_test.go
index 19209f6..d36d2a9 100644
--- a/bp2build/build_conversion_test.go
+++ b/bp2build/build_conversion_test.go
@@ -229,30 +229,30 @@
 }
 
 func TestGenerateBazelTargetModules(t *testing.T) {
-	testCases := []bp2buildTestCase{
+	testCases := []Bp2buildTestCase{
 		{
-			description: "string ptr props",
-			blueprint: `custom {
+			Description: "string ptr props",
+			Blueprint: `custom {
 	name: "foo",
     string_ptr_prop: "",
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "foo", AttrNameToString{
 					"string_ptr_prop": `""`,
 				}),
 			},
 		},
 		{
-			description: "string props",
-			blueprint: `custom {
+			Description: "string props",
+			Blueprint: `custom {
   name: "foo",
     string_list_prop: ["a", "b"],
     string_ptr_prop: "a",
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "foo", AttrNameToString{
 					"string_list_prop": `[
         "a",
         "b",
@@ -262,15 +262,15 @@
 			},
 		},
 		{
-			description: "control characters",
-			blueprint: `custom {
+			Description: "control characters",
+			Blueprint: `custom {
     name: "foo",
     string_list_prop: ["\t", "\n"],
     string_ptr_prop: "a\t\n\r",
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "foo", AttrNameToString{
 					"string_list_prop": `[
         "\t",
         "\n",
@@ -280,8 +280,8 @@
 			},
 		},
 		{
-			description: "handles dep",
-			blueprint: `custom {
+			Description: "handles dep",
+			Blueprint: `custom {
   name: "has_dep",
   arch_paths: [":dep"],
   bazel_module: { bp2build_available: true },
@@ -292,31 +292,31 @@
   arch_paths: ["abc"],
   bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "dep", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "dep", AttrNameToString{
 					"arch_paths": `["abc"]`,
 				}),
-				makeBazelTarget("custom", "has_dep", attrNameToString{
+				makeBazelTarget("custom", "has_dep", AttrNameToString{
 					"arch_paths": `[":dep"]`,
 				}),
 			},
 		},
 		{
-			description: "non-existent dep",
-			blueprint: `custom {
+			Description: "non-existent dep",
+			Blueprint: `custom {
   name: "has_dep",
   arch_paths: [":dep"],
   bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "has_dep", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "has_dep", AttrNameToString{
 					"arch_paths": `[":dep__BP2BUILD__MISSING__DEP"]`,
 				}),
 			},
 		},
 		{
-			description: "arch-variant srcs",
-			blueprint: `custom {
+			Description: "arch-variant srcs",
+			Blueprint: `custom {
     name: "arch_paths",
     arch: {
       x86: { arch_paths: ["x86.txt"] },
@@ -344,8 +344,8 @@
     },
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "arch_paths", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "arch_paths", AttrNameToString{
 					"arch_paths": `select({
         "//build/bazel/platforms/arch:arm": [
             "arm.txt",
@@ -406,8 +406,8 @@
 			},
 		},
 		{
-			description: "arch-variant deps",
-			blueprint: `custom {
+			Description: "arch-variant deps",
+			Blueprint: `custom {
   name: "has_dep",
   arch: {
     x86: {
@@ -422,11 +422,11 @@
     arch_paths: ["abc"],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "dep", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "dep", AttrNameToString{
 					"arch_paths": `["abc"]`,
 				}),
-				makeBazelTarget("custom", "has_dep", attrNameToString{
+				makeBazelTarget("custom", "has_dep", AttrNameToString{
 					"arch_paths": `select({
         "//build/bazel/platforms/arch:x86": [":dep"],
         "//conditions:default": [],
@@ -435,27 +435,27 @@
 			},
 		},
 		{
-			description: "embedded props",
-			blueprint: `custom {
+			Description: "embedded props",
+			Blueprint: `custom {
     name: "embedded_props",
     embedded_prop: "abc",
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "embedded_props", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "embedded_props", AttrNameToString{
 					"embedded_attr": `"abc"`,
 				}),
 			},
 		},
 		{
-			description: "ptr to embedded props",
-			blueprint: `custom {
+			Description: "ptr to embedded props",
+			Blueprint: `custom {
     name: "ptr_to_embedded_props",
     other_embedded_prop: "abc",
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTarget("custom", "ptr_to_embedded_props", attrNameToString{
+			ExpectedBazelTargets: []string{
+				makeBazelTarget("custom", "ptr_to_embedded_props", AttrNameToString{
 					"other_embedded_attr": `"abc"`,
 				}),
 			},
@@ -464,8 +464,8 @@
 
 	dir := "."
 	for _, testCase := range testCases {
-		t.Run(testCase.description, func(t *testing.T) {
-			config := android.TestConfig(buildDir, nil, testCase.blueprint, nil)
+		t.Run(testCase.Description, func(t *testing.T) {
+			config := android.TestConfig(buildDir, nil, testCase.Blueprint, nil)
 			ctx := android.NewTestContext(config)
 
 			registerCustomModuleForBp2buildConversion(ctx)
@@ -483,10 +483,10 @@
 			bazelTargets, err := generateBazelTargetsForDir(codegenCtx, dir)
 			android.FailIfErrored(t, err)
 
-			if actualCount, expectedCount := len(bazelTargets), len(testCase.expectedBazelTargets); actualCount != expectedCount {
-				t.Errorf("Expected %d bazel target (%s),\ngot %d (%s)", expectedCount, testCase.expectedBazelTargets, actualCount, bazelTargets)
+			if actualCount, expectedCount := len(bazelTargets), len(testCase.ExpectedBazelTargets); actualCount != expectedCount {
+				t.Errorf("Expected %d bazel target (%s),\ngot %d (%s)", expectedCount, testCase.ExpectedBazelTargets, actualCount, bazelTargets)
 			} else {
-				for i, expectedBazelTarget := range testCase.expectedBazelTargets {
+				for i, expectedBazelTarget := range testCase.ExpectedBazelTargets {
 					actualBazelTarget := bazelTargets[i]
 					if actualBazelTarget.content != expectedBazelTarget {
 						t.Errorf(
@@ -502,83 +502,83 @@
 }
 
 func TestBp2buildHostAndDevice(t *testing.T) {
-	testCases := []bp2buildTestCase{
+	testCases := []Bp2buildTestCase{
 		{
-			description:                "host and device, device only",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, device only",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetHostOrDevice("custom", "foo", attrNameToString{}, android.DeviceSupported),
+			ExpectedBazelTargets: []string{
+				makeBazelTargetHostOrDevice("custom", "foo", AttrNameToString{}, android.DeviceSupported),
 			},
 		},
 		{
-			description:                "host and device, both",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, both",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: true,
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("custom", "foo", attrNameToString{}),
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("custom", "foo", AttrNameToString{}),
 			},
 		},
 		{
-			description:                "host and device, host explicitly disabled",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, host explicitly disabled",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: false,
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetHostOrDevice("custom", "foo", attrNameToString{}, android.DeviceSupported),
+			ExpectedBazelTargets: []string{
+				makeBazelTargetHostOrDevice("custom", "foo", AttrNameToString{}, android.DeviceSupported),
 			},
 		},
 		{
-			description:                "host and device, neither",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, neither",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: false,
 		device_supported: false,
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("custom", "foo", AttrNameToString{
 					"target_compatible_with": `["@platforms//:incompatible"]`,
 				}),
 			},
 		},
 		{
-			description:                "host and device, neither, cannot override with product_var",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, neither, cannot override with product_var",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: false,
 		device_supported: false,
 		product_variables: { unbundled_build: { enabled: true } },
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("custom", "foo", AttrNameToString{
 					"target_compatible_with": `["@platforms//:incompatible"]`,
 				}),
 			},
 		},
 		{
-			description:                "host and device, both, disabled overrided with product_var",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, both, disabled overrided with product_var",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: true,
 		device_supported: true,
@@ -586,117 +586,117 @@
 		product_variables: { unbundled_build: { enabled: true } },
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("custom", "foo", AttrNameToString{
 					"target_compatible_with": `["//build/bazel/product_variables:unbundled_build"]`,
 				}),
 			},
 		},
 		{
-			description:                "host and device, neither, cannot override with arch enabled",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, neither, cannot override with arch enabled",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: false,
 		device_supported: false,
 		arch: { x86: { enabled: true } },
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("custom", "foo", AttrNameToString{
 					"target_compatible_with": `["@platforms//:incompatible"]`,
 				}),
 			},
 		},
 		{
-			description:                "host and device, host only",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
-			blueprint: `custom {
+			Description:                "host and device, host only",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDevice,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: true,
 		device_supported: false,
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetHostOrDevice("custom", "foo", attrNameToString{}, android.HostSupported),
+			ExpectedBazelTargets: []string{
+				makeBazelTargetHostOrDevice("custom", "foo", AttrNameToString{}, android.HostSupported),
 			},
 		},
 		{
-			description:                "host only",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostSupported,
-			blueprint: `custom {
+			Description:                "host only",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostSupported,
+			Blueprint: `custom {
 		name: "foo",
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetHostOrDevice("custom", "foo", attrNameToString{}, android.HostSupported),
+			ExpectedBazelTargets: []string{
+				makeBazelTargetHostOrDevice("custom", "foo", AttrNameToString{}, android.HostSupported),
 			},
 		},
 		{
-			description:                "device only",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryDeviceSupported,
-			blueprint: `custom {
+			Description:                "device only",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryDeviceSupported,
+			Blueprint: `custom {
 		name: "foo",
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetHostOrDevice("custom", "foo", attrNameToString{}, android.DeviceSupported),
+			ExpectedBazelTargets: []string{
+				makeBazelTargetHostOrDevice("custom", "foo", AttrNameToString{}, android.DeviceSupported),
 			},
 		},
 		{
-			description:                "host and device default, default",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
-			blueprint: `custom {
+			Description:                "host and device default, default",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
+			Blueprint: `custom {
 		name: "foo",
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("custom", "foo", attrNameToString{}),
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("custom", "foo", AttrNameToString{}),
 			},
 		},
 		{
-			description:                "host and device default, device only",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
-			blueprint: `custom {
+			Description:                "host and device default, device only",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: false,
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetHostOrDevice("custom", "foo", attrNameToString{}, android.DeviceSupported),
+			ExpectedBazelTargets: []string{
+				makeBazelTargetHostOrDevice("custom", "foo", AttrNameToString{}, android.DeviceSupported),
 			},
 		},
 		{
-			description:                "host and device default, host only",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
-			blueprint: `custom {
+			Description:                "host and device default, host only",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
+			Blueprint: `custom {
 		name: "foo",
 		device_supported: false,
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetHostOrDevice("custom", "foo", attrNameToString{}, android.HostSupported),
+			ExpectedBazelTargets: []string{
+				makeBazelTargetHostOrDevice("custom", "foo", AttrNameToString{}, android.HostSupported),
 			},
 		},
 		{
-			description:                "host and device default, neither",
-			moduleTypeUnderTest:        "custom",
-			moduleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
-			blueprint: `custom {
+			Description:                "host and device default, neither",
+			ModuleTypeUnderTest:        "custom",
+			ModuleTypeUnderTestFactory: customModuleFactoryHostAndDeviceDefault,
+			Blueprint: `custom {
 		name: "foo",
 		host_supported: false,
 		device_supported: false,
 		bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("custom", "foo", attrNameToString{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("custom", "foo", AttrNameToString{
 					"target_compatible_with": `["@platforms//:incompatible"]`,
 				}),
 			},
@@ -704,7 +704,7 @@
 	}
 
 	for _, tc := range testCases {
-		t.Run(tc.description, func(t *testing.T) {
+		t.Run(tc.Description, func(t *testing.T) {
 			runBp2BuildTestCaseSimple(t, tc)
 		})
 	}
@@ -880,43 +880,43 @@
 }
 
 func TestModuleTypeBp2Build(t *testing.T) {
-	testCases := []bp2buildTestCase{
+	testCases := []Bp2buildTestCase{
 		{
-			description:                "filegroup with does not specify srcs",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "filegroup with does not specify srcs",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{}),
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{}),
 			},
 		},
 		{
-			description:                "filegroup with no srcs",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "filegroup with no srcs",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     srcs: [],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{}),
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{}),
 			},
 		},
 		{
-			description:                "filegroup with srcs",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "filegroup with srcs",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     srcs: ["a", "b"],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"srcs": `[
         "a",
         "b",
@@ -925,32 +925,32 @@
 			},
 		},
 		{
-			description:                "filegroup with excludes srcs",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "filegroup with excludes srcs",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     srcs: ["a", "b"],
     exclude_srcs: ["a"],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"srcs": `["b"]`,
 				}),
 			},
 		},
 		{
-			description:                "filegroup with glob",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "filegroup with glob",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     srcs: ["**/*.txt"],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"srcs": `[
         "other/a.txt",
         "other/b.txt",
@@ -958,7 +958,7 @@
     ]`,
 				}),
 			},
-			filesystem: map[string]string{
+			Filesystem: map[string]string{
 				"other/a.txt":        "",
 				"other/b.txt":        "",
 				"other/subdir/a.txt": "",
@@ -966,11 +966,11 @@
 			},
 		},
 		{
-			description:                "filegroup with glob in subdir",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			dir:                        "other",
-			filesystem: map[string]string{
+			Description:                "filegroup with glob in subdir",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Dir:                        "other",
+			Filesystem: map[string]string{
 				"other/Android.bp": `filegroup {
     name: "fg_foo",
     srcs: ["**/*.txt"],
@@ -981,8 +981,8 @@
 				"other/subdir/a.txt": "",
 				"other/file":         "",
 			},
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"srcs": `[
         "a.txt",
         "b.txt",
@@ -992,10 +992,10 @@
 			},
 		},
 		{
-			description:                "depends_on_other_dir_module",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "depends_on_other_dir_module",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     srcs: [
         ":foo",
@@ -1003,15 +1003,15 @@
     ],
     bazel_module: { bp2build_available: true },
 }`,
-			filesystem: map[string]string{
+			Filesystem: map[string]string{
 				"other/Android.bp": `filegroup {
     name: "foo",
     srcs: ["a", "b"],
     bazel_module: { bp2build_available: true },
 }`,
 			},
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"srcs": `[
         "//other:foo",
         "c",
@@ -1020,11 +1020,11 @@
 			},
 		},
 		{
-			description:                "depends_on_other_unconverted_module_error",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			unconvertedDepsMode:        errorModulesUnconvertedDeps,
-			blueprint: `filegroup {
+			Description:                "depends_on_other_unconverted_module_error",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			UnconvertedDepsMode:        errorModulesUnconvertedDeps,
+			Blueprint: `filegroup {
     name: "foobar",
     srcs: [
         ":foo",
@@ -1032,8 +1032,8 @@
     ],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedErr: fmt.Errorf(`"foobar" depends on unconverted modules: foo`),
-			filesystem: map[string]string{
+			ExpectedErr: fmt.Errorf(`"foobar" depends on unconverted modules: foo`),
+			Filesystem: map[string]string{
 				"other/Android.bp": `filegroup {
     name: "foo",
     srcs: ["a", "b"],
@@ -1043,8 +1043,8 @@
 	}
 
 	for _, testCase := range testCases {
-		t.Run(testCase.description, func(t *testing.T) {
-			runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, testCase)
+		t.Run(testCase.Description, func(t *testing.T) {
+			RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, testCase)
 		})
 	}
 }
@@ -1244,27 +1244,27 @@
 }
 
 func TestCombineBuildFilesBp2buildTargets(t *testing.T) {
-	testCases := []bp2buildTestCase{
+	testCases := []Bp2buildTestCase{
 		{
-			description:                "filegroup bazel_module.label",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "filegroup bazel_module.label",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     bazel_module: { label: "//other:fg_foo" },
 }`,
-			expectedBazelTargets: []string{
+			ExpectedBazelTargets: []string{
 				`// BUILD file`,
 			},
-			filesystem: map[string]string{
+			Filesystem: map[string]string{
 				"other/BUILD.bazel": `// BUILD file`,
 			},
 		},
 		{
-			description:                "multiple bazel_module.label same BUILD",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "multiple bazel_module.label same BUILD",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
         name: "fg_foo",
         bazel_module: { label: "//other:fg_foo" },
     }
@@ -1273,20 +1273,20 @@
         name: "foo",
         bazel_module: { label: "//other:foo" },
     }`,
-			expectedBazelTargets: []string{
+			ExpectedBazelTargets: []string{
 				`// BUILD file`,
 			},
-			filesystem: map[string]string{
+			Filesystem: map[string]string{
 				"other/BUILD.bazel": `// BUILD file`,
 			},
 		},
 		{
-			description:                "filegroup bazel_module.label and bp2build in subdir",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			dir:                        "other",
-			blueprint:                  ``,
-			filesystem: map[string]string{
+			Description:                "filegroup bazel_module.label and bp2build in subdir",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Dir:                        "other",
+			Blueprint:                  ``,
+			Filesystem: map[string]string{
 				"other/Android.bp": `filegroup {
         name: "fg_foo",
         bazel_module: {
@@ -1301,20 +1301,20 @@
       }`,
 				"other/BUILD.bazel": `// definition for fg_bar`,
 			},
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{}),
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{}),
 				`// definition for fg_bar`,
 			},
 		},
 		{
-			description:                "filegroup bazel_module.label and filegroup bp2build",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
+			Description:                "filegroup bazel_module.label and filegroup bp2build",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
 
-			filesystem: map[string]string{
+			Filesystem: map[string]string{
 				"other/BUILD.bazel": `// BUILD file`,
 			},
-			blueprint: `filegroup {
+			Blueprint: `filegroup {
         name: "fg_foo",
         bazel_module: {
           label: "//other:fg_foo",
@@ -1327,8 +1327,8 @@
           bp2build_available: true,
         },
     }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_bar", map[string]string{}),
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_bar", map[string]string{}),
 				`// BUILD file`,
 			},
 		},
@@ -1336,20 +1336,20 @@
 
 	dir := "."
 	for _, testCase := range testCases {
-		t.Run(testCase.description, func(t *testing.T) {
+		t.Run(testCase.Description, func(t *testing.T) {
 			fs := make(map[string][]byte)
 			toParse := []string{
 				"Android.bp",
 			}
-			for f, content := range testCase.filesystem {
+			for f, content := range testCase.Filesystem {
 				if strings.HasSuffix(f, "Android.bp") {
 					toParse = append(toParse, f)
 				}
 				fs[f] = []byte(content)
 			}
-			config := android.TestConfig(buildDir, nil, testCase.blueprint, fs)
+			config := android.TestConfig(buildDir, nil, testCase.Blueprint, fs)
 			ctx := android.NewTestContext(config)
-			ctx.RegisterModuleType(testCase.moduleTypeUnderTest, testCase.moduleTypeUnderTestFactory)
+			ctx.RegisterModuleType(testCase.ModuleTypeUnderTest, testCase.ModuleTypeUnderTestFactory)
 			ctx.RegisterForBazelConversion()
 
 			_, errs := ctx.ParseFileList(dir, toParse)
@@ -1362,15 +1362,15 @@
 			}
 
 			checkDir := dir
-			if testCase.dir != "" {
-				checkDir = testCase.dir
+			if testCase.Dir != "" {
+				checkDir = testCase.Dir
 			}
 			codegenCtx := NewCodegenContext(config, *ctx.Context, Bp2Build)
 			bazelTargets, err := generateBazelTargetsForDir(codegenCtx, checkDir)
 			android.FailIfErrored(t, err)
 			bazelTargets.sort()
 			actualCount := len(bazelTargets)
-			expectedCount := len(testCase.expectedBazelTargets)
+			expectedCount := len(testCase.ExpectedBazelTargets)
 			if actualCount != expectedCount {
 				t.Errorf("Expected %d bazel target, got %d\n%s", expectedCount, actualCount, bazelTargets)
 			}
@@ -1379,7 +1379,7 @@
 			}
 			for i, target := range bazelTargets {
 				actualContent := target.content
-				expectedContent := testCase.expectedBazelTargets[i]
+				expectedContent := testCase.ExpectedBazelTargets[i]
 				if expectedContent != actualContent {
 					t.Errorf(
 						"Expected generated Bazel target to be '%s', got '%s'",
@@ -1393,18 +1393,18 @@
 }
 
 func TestGlobExcludeSrcs(t *testing.T) {
-	testCases := []bp2buildTestCase{
+	testCases := []Bp2buildTestCase{
 		{
-			description:                "filegroup top level exclude_srcs",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: `filegroup {
+			Description:                "filegroup top level exclude_srcs",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: `filegroup {
     name: "fg_foo",
     srcs: ["**/*.txt"],
     exclude_srcs: ["c.txt"],
     bazel_module: { bp2build_available: true },
 }`,
-			filesystem: map[string]string{
+			Filesystem: map[string]string{
 				"a.txt":          "",
 				"b.txt":          "",
 				"c.txt":          "",
@@ -1412,8 +1412,8 @@
 				"dir/e.txt":      "",
 				"dir/f.txt":      "",
 			},
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"srcs": `[
         "a.txt",
         "b.txt",
@@ -1424,12 +1424,12 @@
 			},
 		},
 		{
-			description:                "filegroup in subdir exclude_srcs",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint:                  "",
-			dir:                        "dir",
-			filesystem: map[string]string{
+			Description:                "filegroup in subdir exclude_srcs",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint:                  "",
+			Dir:                        "dir",
+			Filesystem: map[string]string{
 				"dir/Android.bp": `filegroup {
     name: "fg_foo",
     srcs: ["**/*.txt"],
@@ -1443,8 +1443,8 @@
 				"dir/subdir/e.txt":      "",
 				"dir/subdir/f.txt":      "",
 			},
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"srcs": `[
         "a.txt",
         "//dir/subdir:e.txt",
@@ -1456,35 +1456,35 @@
 	}
 
 	for _, testCase := range testCases {
-		t.Run(testCase.description, func(t *testing.T) {
+		t.Run(testCase.Description, func(t *testing.T) {
 			runBp2BuildTestCaseSimple(t, testCase)
 		})
 	}
 }
 
 func TestCommonBp2BuildModuleAttrs(t *testing.T) {
-	testCases := []bp2buildTestCase{
+	testCases := []Bp2buildTestCase{
 		{
-			description:                "Required into data test",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: simpleModuleDoNotConvertBp2build("filegroup", "reqd") + `
+			Description:                "Required into data test",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: simpleModuleDoNotConvertBp2build("filegroup", "reqd") + `
 filegroup {
     name: "fg_foo",
     required: ["reqd"],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"data": `[":reqd"]`,
 				}),
 			},
 		},
 		{
-			description:                "Required via arch into data test",
-			moduleTypeUnderTest:        "python_library",
-			moduleTypeUnderTestFactory: python.PythonLibraryFactory,
-			blueprint: simpleModuleDoNotConvertBp2build("python_library", "reqdx86") +
+			Description:                "Required via arch into data test",
+			ModuleTypeUnderTest:        "python_library",
+			ModuleTypeUnderTestFactory: python.PythonLibraryFactory,
+			Blueprint: simpleModuleDoNotConvertBp2build("python_library", "reqdx86") +
 				simpleModuleDoNotConvertBp2build("python_library", "reqdarm") + `
 python_library {
     name: "fg_foo",
@@ -1498,7 +1498,7 @@
     },
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
+			ExpectedBazelTargets: []string{
 				makeBazelTarget("py_library", "fg_foo", map[string]string{
 					"data": `select({
         "//build/bazel/platforms/arch:arm": [":reqdarm"],
@@ -1511,21 +1511,21 @@
 			},
 		},
 		{
-			description:                "Required appended to data test",
-			moduleTypeUnderTest:        "python_library",
-			moduleTypeUnderTestFactory: python.PythonLibraryFactory,
-			filesystem: map[string]string{
+			Description:                "Required appended to data test",
+			ModuleTypeUnderTest:        "python_library",
+			ModuleTypeUnderTestFactory: python.PythonLibraryFactory,
+			Filesystem: map[string]string{
 				"data.bin": "",
 				"src.py":   "",
 			},
-			blueprint: simpleModuleDoNotConvertBp2build("python_library", "reqd") + `
+			Blueprint: simpleModuleDoNotConvertBp2build("python_library", "reqd") + `
 python_library {
     name: "fg_foo",
     data: ["data.bin"],
     required: ["reqd"],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
+			ExpectedBazelTargets: []string{
 				makeBazelTarget("py_library", "fg_foo", map[string]string{
 					"data": `[
         "data.bin",
@@ -1537,17 +1537,17 @@
 			},
 		},
 		{
-			description:                "All props-to-attrs at once together test",
-			moduleTypeUnderTest:        "filegroup",
-			moduleTypeUnderTestFactory: android.FileGroupFactory,
-			blueprint: simpleModuleDoNotConvertBp2build("filegroup", "reqd") + `
+			Description:                "All props-to-attrs at once together test",
+			ModuleTypeUnderTest:        "filegroup",
+			ModuleTypeUnderTestFactory: android.FileGroupFactory,
+			Blueprint: simpleModuleDoNotConvertBp2build("filegroup", "reqd") + `
 filegroup {
     name: "fg_foo",
     required: ["reqd"],
     bazel_module: { bp2build_available: true },
 }`,
-			expectedBazelTargets: []string{
-				makeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
+			ExpectedBazelTargets: []string{
+				MakeBazelTargetNoRestrictions("filegroup", "fg_foo", map[string]string{
 					"data": `[":reqd"]`,
 				}),
 			},
@@ -1555,7 +1555,7 @@
 	}
 
 	for _, tc := range testCases {
-		t.Run(tc.description, func(t *testing.T) {
+		t.Run(tc.Description, func(t *testing.T) {
 			runBp2BuildTestCaseSimple(t, tc)
 		})
 	}