blob: b50228f7a521dcc30b58c3a3ea20a42f48fbd0b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package funcs
import (
"context"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCreateSockaddrFuncs(t *testing.T) {
for i := 0; i < 10; i++ {
// Run this a bunch to catch race conditions
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()
ctx := context.Background()
fmap := CreateSockaddrFuncs(ctx)
actual := fmap["sockaddr"].(func() interface{})
assert.Same(t, ctx, actual().(*SockaddrFuncs).ctx)
})
}
}
|