mirror of
https://github.com/status-im/consul.git
synced 2025-02-13 06:06:40 +00:00
Consolidate code duplication and tests into a single lib package. Most of these functions were from various **/util.go functions that couldn't be imported due to cyclic imports. The consul/lib package is intended to be a terminal node in an import DAG and a place to stash various consul-only helper functions. Pulled in hashicorp/go-uuid instead of consolidating UUID access.
25 lines
405 B
Go
25 lines
405 B
Go
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")
|
|
}
|
|
}
|
|
|
|
func TestToLowerList(t *testing.T) {
|
|
l := []string{"ABC", "Abc", "abc"}
|
|
for _, value := range ToLowerList(l) {
|
|
if value != "abc" {
|
|
t.Fatalf("failed lowercasing")
|
|
}
|
|
}
|
|
}
|