Make SortedStringKeys call SortedKeys

I realized this could work if I make it generic.

Bug: 193460475
Test: m nothing
Change-Id: I2071b4cdbccb642ebdbb1342f7d91e581aab9f0f
This commit is contained in:
Cole Faust
2023-03-01 14:21:30 -08:00
parent 29ff4182f5
commit 195c7819fb
2 changed files with 2 additions and 53 deletions

View File

@@ -671,44 +671,6 @@ func TestSortedKeys(t *testing.T) {
testSortedKeysHelper(t, "empty", map[string]string{}, nil)
}
func TestSortedStringKeys(t *testing.T) {
testCases := []struct {
name string
in interface{}
expected []string
}{
{
name: "nil",
in: map[string]string(nil),
expected: nil,
},
{
name: "empty",
in: map[string]string{},
expected: nil,
},
{
name: "simple",
in: map[string]string{"a": "foo", "b": "bar"},
expected: []string{"a", "b"},
},
{
name: "interface values",
in: map[string]interface{}{"a": nil, "b": nil},
expected: []string{"a", "b"},
},
}
for _, tt := range testCases {
t.Run(tt.name, func(t *testing.T) {
got := SortedStringKeys(tt.in)
if g, w := got, tt.expected; !reflect.DeepEqual(g, w) {
t.Errorf("wanted %q, got %q", w, g)
}
})
}
}
func TestSortedStringValues(t *testing.T) {
testCases := []struct {
name string