Merge "Improve TestGetDistForGoals debuggability"

This commit is contained in:
Paul Duffin
2020-11-26 17:16:53 +00:00
committed by Gerrit Code Review

View File

@@ -104,10 +104,12 @@ func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testin
func TestGetDistForGoals(t *testing.T) { func TestGetDistForGoals(t *testing.T) {
testCases := []struct { testCases := []struct {
name string
bp string bp string
expectedAndroidMkLines []string expectedAndroidMkLines []string
}{ }{
{ {
name: "dist-without-tag",
bp: ` bp: `
custom { custom {
name: "foo", name: "foo",
@@ -122,6 +124,7 @@ func TestGetDistForGoals(t *testing.T) {
}, },
}, },
{ {
name: "dist-with-tag",
bp: ` bp: `
custom { custom {
name: "foo", name: "foo",
@@ -137,6 +140,7 @@ func TestGetDistForGoals(t *testing.T) {
}, },
}, },
{ {
name: "dists-with-tag",
bp: ` bp: `
custom { custom {
name: "foo", name: "foo",
@@ -154,6 +158,7 @@ func TestGetDistForGoals(t *testing.T) {
}, },
}, },
{ {
name: "multiple-dists-with-and-without-tag",
bp: ` bp: `
custom { custom {
name: "foo", name: "foo",
@@ -175,6 +180,7 @@ func TestGetDistForGoals(t *testing.T) {
}, },
}, },
{ {
name: "dist-plus-dists-without-tags",
bp: ` bp: `
custom { custom {
name: "foo", name: "foo",
@@ -196,6 +202,7 @@ func TestGetDistForGoals(t *testing.T) {
}, },
}, },
{ {
name: "dist-plus-dists-with-tags",
bp: ` bp: `
custom { custom {
name: "foo", name: "foo",
@@ -249,6 +256,7 @@ func TestGetDistForGoals(t *testing.T) {
} }
for _, testCase := range testCases { for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
config := TestConfig(buildDir, nil, testCase.bp, nil) config := TestConfig(buildDir, nil, testCase.bp, nil)
config.katiEnabled = true // Enable androidmk Singleton config.katiEnabled = true // Enable androidmk Singleton
@@ -282,10 +290,11 @@ func TestGetDistForGoals(t *testing.T) {
if line != expectedLine { if line != expectedLine {
t.Errorf( t.Errorf(
"Expected AndroidMk line to be '%s', got '%s'", "Expected AndroidMk line to be '%s', got '%s'",
line,
expectedLine, expectedLine,
line,
) )
} }
} }
})
} }
} }