deadcode: quotedList() keysWithColons()

This commit is contained in:
Tom Limoncelli 2024-03-03 10:29:32 -05:00
parent 18f7208044
commit e4dc7aaf38
2 changed files with 0 additions and 68 deletions

View file

@ -19,23 +19,6 @@ import (
"github.com/google/shlex"
)
func quotedList(l []string) string {
if len(l) == 0 {
return ""
}
return `"` + strings.Join(l, `", "`) + `"`
}
func keysWithColons(list []string) []string {
var r []string
for _, k := range list {
if strings.Contains(k, ":") {
r = append(r, k)
}
}
return r
}
// LoadProviderConfigs will open or execute the specified file name, and parse its contents. It will replace environment variables it finds if any value matches $[A-Za-z_-0-9]+
func LoadProviderConfigs(fname string) (map[string]map[string]string, error) {
var results = map[string]map[string]string{}

View file

@ -1,51 +0,0 @@
package credsfile
import (
"reflect"
"testing"
)
func Test_keysWithColons(t *testing.T) {
type args struct {
list []string
}
tests := []struct {
name string
args args
want []string
}{
{"0", args{list: []string{""}}, nil},
{"1", args{list: []string{"none"}}, nil},
{"2", args{list: []string{"a:b"}}, []string{"a:b"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := keysWithColons(tt.args.list); !reflect.DeepEqual(got, tt.want) {
t.Errorf("keysWithColons() = %v, want %v", got, tt.want)
}
})
}
}
func Test_quotedList(t *testing.T) {
type args struct {
l []string
}
tests := []struct {
name string
args args
want string
}{
{"none", args{}, ""},
{"single", args{l: []string{"one"}}, `"one"`},
{"two", args{l: []string{"ricky", "lucy"}}, `"ricky", "lucy"`},
{"three", args{l: []string{"manny", "moe", "jack"}}, `"manny", "moe", "jack"`},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := quotedList(tt.args.l); got != tt.want {
t.Errorf("quotedList() = %v, want %v", got, tt.want)
}
})
}
}