Merge "add test for ShouldKeepExistingBuldFileForDir()" am: 9478303673
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2283373 Change-Id: Iedb26c92212f09fc42a9cc529b98dc3d6cf90630 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
6d7aded12e
@@ -423,3 +423,21 @@ func TestBp2buildAllowList(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestShouldKeepExistingBuildFileForDir(t *testing.T) {
|
||||
allowlist := NewBp2BuildAllowlist()
|
||||
// entry "a/b2/c2" is moot because of its parent "a/b2"
|
||||
allowlist.SetKeepExistingBuildFile(map[string]bool{"a": false, "a/b1": false, "a/b2": true, "a/b1/c1": true, "a/b2/c2": false})
|
||||
truths := []string{"a", "a/b1", "a/b2", "a/b1/c1", "a/b2/c", "a/b2/c2", "a/b2/c2/d"}
|
||||
falsities := []string{"a1", "a/b", "a/b1/c"}
|
||||
for _, dir := range truths {
|
||||
if !allowlist.ShouldKeepExistingBuildFileForDir(dir) {
|
||||
t.Errorf("%s expected TRUE but was FALSE", dir)
|
||||
}
|
||||
}
|
||||
for _, dir := range falsities {
|
||||
if allowlist.ShouldKeepExistingBuildFileForDir(dir) {
|
||||
t.Errorf("%s expected FALSE but was TRUE", dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user