feat(gost/ubuntu): check kernel source package more strictly (#1599)

This commit is contained in:
MaineK00n
2023-04-20 13:05:41 +09:00
committed by GitHub
parent fb904f0543
commit 99dc8e892f
4 changed files with 203 additions and 9 deletions

View File

@@ -309,3 +309,38 @@ func TestDebian_detect(t *testing.T) {
})
}
}
func TestDebian_isKernelSourcePackage(t *testing.T) {
tests := []struct {
pkgname string
want bool
}{
{
pkgname: "linux",
want: true,
},
{
pkgname: "apt",
want: false,
},
{
pkgname: "linux-5.10",
want: true,
},
{
pkgname: "linux-grsec",
want: true,
},
{
pkgname: "linux-base",
want: false,
},
}
for _, tt := range tests {
t.Run(tt.pkgname, func(t *testing.T) {
if got := (Debian{}).isKernelSourcePackage(tt.pkgname); got != tt.want {
t.Errorf("Debian.isKernelSourcePackage() = %v, want %v", got, tt.want)
}
})
}
}