We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 604746b commit 060b847Copy full SHA for 060b847
util/util.go
@@ -1,8 +1,10 @@
1
package util
2
3
+import "strings"
4
+
5
func SliceContainsString(s []string, e string) bool {
6
for _, a := range s {
- if a == e {
7
+ if strings.Contains(a, e) {
8
return true
9
}
10
util/util_test.go
@@ -0,0 +1,11 @@
+package util
+import "testing"
+func TestSliceContainsString(t *testing.T) {
+ slice := []string{"'my-package_0.1.0_amd64.deb' has already been taken"}
+ result := SliceContainsString(slice, "has already been taken")
+ if !result {
+ t.Error("slice did not contain string")
+ }
11
+}
0 commit comments