flatmap: deterministic tests

This commit is contained in:
Mitchell Hashimoto 2014-07-10 13:32:16 -07:00
parent 4a3d51f40e
commit 485bc668bf
1 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package flatmap
import (
"reflect"
"sort"
"testing"
)
@ -36,14 +37,18 @@ func TestMapKeys(t *testing.T) {
"bar.0.baz": "bar",
},
Output: []string{
"foo",
"bar",
"foo",
},
},
}
for _, tc := range cases {
actual := Map(tc.Input).Keys()
// Sort so we have a consistent view of the output
sort.Strings(actual)
if !reflect.DeepEqual(actual, tc.Output) {
t.Fatalf("input: %#v\n\nbad: %#v", tc.Input, actual)
}