mirror of https://github.com/hashicorp/consul
R.B. Boyer
5 years ago
committed by
GitHub
13 changed files with 70 additions and 70 deletions
@ -1,11 +0,0 @@
|
||||
package lib |
||||
|
||||
// StrContains checks if a list contains a string
|
||||
func StrContains(l []string, s string) bool { |
||||
for _, v := range l { |
||||
if v == s { |
||||
return true |
||||
} |
||||
} |
||||
return false |
||||
} |
@ -1,15 +0,0 @@
|
||||
package lib |
||||
|
||||
import ( |
||||
"testing" |
||||
) |
||||
|
||||
func TestStrContains(t *testing.T) { |
||||
l := []string{"a", "b", "c"} |
||||
if !StrContains(l, "b") { |
||||
t.Fatalf("should contain") |
||||
} |
||||
if StrContains(l, "d") { |
||||
t.Fatalf("should not contain") |
||||
} |
||||
} |
Loading…
Reference in new issue