Skip to content

Commit 4a29f5a

Browse files
committed
copy test over
1 parent 10837f4 commit 4a29f5a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mslices/slices_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,26 @@ func (s *mySuite) Test_Of() {
2525

2626
s.Assert().Equal(1, b[0], "should copy slice")
2727
}
28+
29+
func (s *mySuite) Test_ToMap() {
30+
type stuff struct {
31+
Name string
32+
}
33+
34+
mySlice := []stuff{{"foo"}, {"bar"}, {"bar"}}
35+
36+
myMap := ToMap(
37+
mySlice,
38+
func(el stuff) string {
39+
return el.Name
40+
},
41+
)
42+
43+
s.Assert().Equal(
44+
map[string]stuff{
45+
"foo": {"foo"},
46+
"bar": {"bar"},
47+
},
48+
myMap,
49+
)
50+
}

0 commit comments

Comments
 (0)