1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 "internal/x/net/nettest"
16 func TestPipe(t
*testing
.T
) {
17 nettest
.TestConn(t
, func() (c1
, c2 net
.Conn
, stop
func(), err error
) {
27 func TestPipeCloseError(t
*testing
.T
) {
31 if _
, err
:= c1
.Read(nil); err
!= io
.ErrClosedPipe
{
32 t
.Errorf("c1.Read() = %v, want io.ErrClosedPipe", err
)
34 if _
, err
:= c1
.Write(nil); err
!= io
.ErrClosedPipe
{
35 t
.Errorf("c1.Write() = %v, want io.ErrClosedPipe", err
)
37 if err
:= c1
.SetDeadline(time
.Time
{}); err
!= io
.ErrClosedPipe
{
38 t
.Errorf("c1.SetDeadline() = %v, want io.ErrClosedPipe", err
)
40 if _
, err
:= c2
.Read(nil); err
!= io
.EOF
{
41 t
.Errorf("c2.Read() = %v, want io.EOF", err
)
43 if _
, err
:= c2
.Write(nil); err
!= io
.ErrClosedPipe
{
44 t
.Errorf("c2.Write() = %v, want io.ErrClosedPipe", err
)
46 if err
:= c2
.SetDeadline(time
.Time
{}); err
!= io
.ErrClosedPipe
{
47 t
.Errorf("c2.SetDeadline() = %v, want io.ErrClosedPipe", err
)