fix(redhat): possibility of false positives on RHEL (#1115)

This commit is contained in:
Kota Kanbe
2021-01-06 13:33:08 +09:00
committed by GitHub
parent b13f93a2d3
commit 4359503484
2 changed files with 41 additions and 5 deletions

View File

@@ -1193,3 +1193,36 @@ func Test_major(t *testing.T) {
}
}
}
func Test_centOSVersionToRHEL(t *testing.T) {
type args struct {
ver string
}
tests := []struct {
name string
args args
want string
}{
{
name: "remove centos.",
args: args{
ver: "grub2-tools-2.02-0.80.el7.centos.x86_64",
},
want: "grub2-tools-2.02-0.80.el7.x86_64",
},
{
name: "noop",
args: args{
ver: "grub2-tools-2.02-0.80.el7.x86_64",
},
want: "grub2-tools-2.02-0.80.el7.x86_64",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := centOSVersionToRHEL(tt.args.ver); got != tt.want {
t.Errorf("centOSVersionToRHEL() = %v, want %v", got, tt.want)
}
})
}
}