Skip to content

Commit 485bc66

Browse files
committed
flatmap: deterministic tests
1 parent 4a3d51f commit 485bc66

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

flatmap/map_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package flatmap
22

33
import (
44
"reflect"
5+
"sort"
56
"testing"
67
)
78

@@ -36,14 +37,18 @@ func TestMapKeys(t *testing.T) {
3637
"bar.0.baz": "bar",
3738
},
3839
Output: []string{
39-
"foo",
4040
"bar",
41+
"foo",
4142
},
4243
},
4344
}
4445

4546
for _, tc := range cases {
4647
actual := Map(tc.Input).Keys()
48+
49+
// Sort so we have a consistent view of the output
50+
sort.Strings(actual)
51+
4752
if !reflect.DeepEqual(actual, tc.Output) {
4853
t.Fatalf("input: %#v\n\nbad: %#v", tc.Input, actual)
4954
}

0 commit comments

Comments
 (0)