socketpair: directly export *net.UnixConn (and add test for that behavior)

This commit is contained in:
Christian Schwarz
2018-12-30 20:22:54 +01:00
parent 76a6c623f3
commit d281fb00e3
2 changed files with 27 additions and 19 deletions

View File

@ -0,0 +1,18 @@
package socketpair
import (
"testing"
"github.com/stretchr/testify/assert"
)
// This is test is mostly to verify that the assumption about
// net.FileConn returning *net.UnixConn for AF_UNIX FDs works.
func TestSocketPairWorks(t *testing.T) {
assert.NotPanics(t, func() {
a, b, err := SocketPair()
assert.NoError(t, err)
a.Close()
b.Close()
})
}