added tests for move-property in bpmodify

Test: m nothing
Signed-off-by: Alix <agespino@google.com>
Change-Id: Ib8f1e88f7587476845e64a9d9ff96afb2b8d2df8
This commit is contained in:
Alix 2022-05-11 16:40:26 +00:00
parent c93385a75a
commit 30751b313c

View file

@ -31,6 +31,8 @@ var testCases = []struct {
setString *string setString *string
removeProperty bool removeProperty bool
replaceProperty string replaceProperty string
moveProperty bool
newLocation string
}{ }{
{ {
name: "add", name: "add",
@ -435,6 +437,45 @@ var testCases = []struct {
} }
`, `,
replaceProperty: "foo:foo_lib,baz:baz_lib", replaceProperty: "foo:foo_lib,baz:baz_lib",
}, {
name: "move contents of property into non-existing property",
input: `
cc_foo {
name: "foo",
bar: ["barContents"],
}
`,
output: `
cc_foo {
name: "foo",
baz: ["barContents"],
}
`,
property: "bar",
moveProperty: true,
newLocation: "baz",
}, {
name: "move contents of property into existing property",
input: `
cc_foo {
name: "foo",
baz: ["bazContents"],
bar: ["barContents"],
}
`,
output: `
cc_foo {
name: "foo",
baz: [
"bazContents",
"barContents",
],
}
`,
property: "bar",
moveProperty: true,
newLocation: "baz",
}, },
} }
@ -452,6 +493,8 @@ func TestProcessModule(t *testing.T) {
addIdents.Set(testCase.addSet) addIdents.Set(testCase.addSet)
removeIdents.Set(testCase.removeSet) removeIdents.Set(testCase.removeSet)
removeProperty = &testCase.removeProperty removeProperty = &testCase.removeProperty
moveProperty = &testCase.moveProperty
newLocation = testCase.newLocation
setString = testCase.setString setString = testCase.setString
addLiteral = testCase.addLiteral addLiteral = testCase.addLiteral
replaceProperty.Set(testCase.replaceProperty) replaceProperty.Set(testCase.replaceProperty)