Commit 68df3073 authored by yanxuean's avatar yanxuean

add test for slice

parent 6e950cc6
......@@ -89,3 +89,20 @@ func TestShuffleStrings(t *testing.T) {
}
}
}
func TestContainsString(t *testing.T) {
src := []string{"aa", "bb", "cc"}
if !ContainsString(src, "bb", nil) {
t.Errorf("ContainsString didn't find the string as expected")
}
modifier := func(s string) string {
if s == "cc" {
return "ee"
}
return s
}
if !ContainsString(src, "ee", modifier) {
t.Errorf("ContainsString didn't find the string by modifier")
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment