added tests for move-property in bpmodify am: 30751b313c am: 8e5808e747 am: 9482312647 am: a8a3411942

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2182736

Change-Id: I3fa2a96b13e80452d60ec4a582e9e9f1bd97eb1b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alix 2022-08-11 16:50:27 +00:00 committed by Automerger Merge Worker
commit a0ea66d4dd

View file

@ -31,6 +31,8 @@ var testCases = []struct {
setString *string
removeProperty bool
replaceProperty string
moveProperty bool
newLocation string
}{
{
name: "add",
@ -435,6 +437,45 @@ var testCases = []struct {
}
`,
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)
removeIdents.Set(testCase.removeSet)
removeProperty = &testCase.removeProperty
moveProperty = &testCase.moveProperty
newLocation = testCase.newLocation
setString = testCase.setString
addLiteral = testCase.addLiteral
replaceProperty.Set(testCase.replaceProperty)