aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/subsystem/entities_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-02-23 19:30:35 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-02-24 10:29:40 +0100
commit0e6628e0d76d6fd6ccb2f4966e144f13fdc68c5c (patch)
treef9345f4e0dfb3a0e927f1bb456afb1feaaad25b8 /pkg/subsystem/entities_test.go
parenta1ab4f01d34b4a7858d84bd662b511f55b4b65c4 (diff)
tools/syz-query-subsystems: add filtering functionality
Two more flags: - filter: allows to choose only a subset of the possible subsystems. - emails: allows to force empty Lists and Maintainers.
Diffstat (limited to 'pkg/subsystem/entities_test.go')
-rw-r--r--pkg/subsystem/entities_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/subsystem/entities_test.go b/pkg/subsystem/entities_test.go
index 58166b91b..81c970b65 100644
--- a/pkg/subsystem/entities_test.go
+++ b/pkg/subsystem/entities_test.go
@@ -39,3 +39,18 @@ func TestSubsystemEmails(t *testing.T) {
"a@list.com", "b@list.com", "c@list.com", "d@list.com", "d@person.com",
})
}
+
+func TestFilterList(t *testing.T) {
+ parentParent := &Subsystem{}
+ parentA := &Subsystem{Parents: []*Subsystem{parentParent}}
+ parentB := &Subsystem{Parents: []*Subsystem{parentParent}}
+ entity := &Subsystem{Parents: []*Subsystem{parentA, parentB}}
+
+ newList := FilterList([]*Subsystem{parentA, parentB, parentParent, entity},
+ func(s *Subsystem) bool {
+ return s != parentB
+ },
+ )
+ assert.Len(t, newList, 3)
+ assert.ElementsMatch(t, entity.Parents, []*Subsystem{parentA})
+}