Refactor: replace StringInSlice with slices.Contains

Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
This commit is contained in:
Oleksandr Redko
2024-01-05 14:48:12 +02:00
parent 82125f14b0
commit 8bdf77aa20
34 changed files with 79 additions and 133 deletions

View File

@ -38,13 +38,6 @@ var _ = Describe("Common functions test", func() {
Expect(session.Command.Process).ShouldNot(BeNil(), "SystemExec cannot start a process")
})
It("Test StringInSlice", func() {
testSlice := []string{"apple", "peach", "pear"}
Expect(StringInSlice("apple", testSlice)).To(BeTrue(), "apple should in ['apple', 'peach', 'pear']")
Expect(StringInSlice("banana", testSlice)).ShouldNot(BeTrue(), "banana should not in ['apple', 'peach', 'pear']")
Expect(StringInSlice("anything", []string{})).ShouldNot(BeTrue(), "anything should not in empty slice")
})
DescribeTable("Test GetHostDistributionInfo",
func(path, id, ver string, empty bool) {
txt := fmt.Sprintf("ID=%s\nVERSION_ID=%s", id, ver)