Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
update for verify
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Miclette committed Oct 11, 2022
1 parent 100b7fb commit 60bf18c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tkg/tkgconfigproviders/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func mapToConfigString(data map[string]string) string {
result := ""
for key, value := range data {
if len(key) > 0 {
result += key + ":" + value + ","
}
result += key + ":" + value + ","
}
}
result = strings.TrimSuffix(result, ",")
return result
Expand Down
14 changes: 7 additions & 7 deletions tkg/tkgconfigproviders/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ func TestMapToConfigString(t *testing.T) {
target := map[string]string{"key1": "value1", "key2": "value2"}
result := mapToConfigString(target)
shouldContain(t, result, "key1:value1")
shouldContain(t, result, "key2:value2")
if strings.LastIndex(result, ",") == len(result)-1 {
t.Fatalf("Test with two keys detected ending comma: \"%s\"", result)
}
shouldContain(t, result, "key2:value2")
if strings.LastIndex(result, ",") == len(result)-1 {
t.Fatalf("Test with two keys detected ending comma: \"%s\"", result)
}

result = mapToConfigString(nil)
shouldBeBlank(t, result, "sending nil")
Expand Down Expand Up @@ -100,9 +100,9 @@ func TestConfigStringToMap(t *testing.T) {
result = configStringToMap(target)
shouldHaveTwoEntries(t, target, result, "key1", "value1", "key2", "value2")

target = "key1:value1,key2:value2"
result = configStringToMap(target)
shouldHaveTwoEntries(t, target, result, "key1", "value1", "key2", "value2")
target = "key1:value1,key2:value2"
result = configStringToMap(target)
shouldHaveTwoEntries(t, target, result, "key1", "value1", "key2", "value2")
}

type testStruct struct {
Expand Down

0 comments on commit 60bf18c

Please # to comment.