mirror of
https://github.com/golang/net.git
synced 2026-04-01 02:47:08 +09:00
nettest: mark test helper functions
Fixes golang/go#30295 Change-Id: Ib98fde1f2f0d166e199238de45ca95aa34164040 Reviewed-on: https://go-review.googlesource.com/c/162925 Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Mikio Hara <mikioh.public.networking@gmail.com>
This commit is contained in:
committed by
Mikio Hara
parent
67f368f454
commit
afe646ca25
@@ -41,6 +41,7 @@ func TestConn(t *testing.T, mp MakePipe) {
|
||||
type connTester func(t *testing.T, c1, c2 net.Conn)
|
||||
|
||||
func timeoutWrapper(t *testing.T, mp MakePipe, f connTester) {
|
||||
t.Helper()
|
||||
c1, c2, stop, err := mp()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to make pipe: %v", err)
|
||||
@@ -390,6 +391,7 @@ func testConcurrentMethods(t *testing.T, c1, c2 net.Conn) {
|
||||
// checkForTimeoutError checks that the error satisfies the Error interface
|
||||
// and that Timeout returns true.
|
||||
func checkForTimeoutError(t *testing.T, err error) {
|
||||
t.Helper()
|
||||
if nerr, ok := err.(net.Error); ok {
|
||||
if !nerr.Timeout() {
|
||||
t.Errorf("err.Timeout() = false, want true")
|
||||
@@ -402,6 +404,7 @@ func checkForTimeoutError(t *testing.T, err error) {
|
||||
// testRoundtrip writes something into c and reads it back.
|
||||
// It assumes that everything written into c is echoed back to itself.
|
||||
func testRoundtrip(t *testing.T, c net.Conn) {
|
||||
t.Helper()
|
||||
if err := c.SetDeadline(neverTimeout); err != nil {
|
||||
t.Errorf("roundtrip SetDeadline error: %v", err)
|
||||
}
|
||||
@@ -423,6 +426,7 @@ func testRoundtrip(t *testing.T, c net.Conn) {
|
||||
// It assumes that everything written into c is echoed back to itself.
|
||||
// It assumes that 0xff is not currently on the wire or in the read buffer.
|
||||
func resyncConn(t *testing.T, c net.Conn) {
|
||||
t.Helper()
|
||||
c.SetDeadline(neverTimeout)
|
||||
errCh := make(chan error)
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user