Source file src/context/net_test.go

     1  // Copyright 2016 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.
     4  
     5  package context_test
     6  
     7  import (
     8  	"context"
     9  	"net"
    10  	"testing"
    11  )
    12  
    13  func TestDeadlineExceededIsNetError(t *testing.T) {
    14  	err, ok := context.DeadlineExceeded.(net.Error)
    15  	if !ok {
    16  		t.Fatal("DeadlineExceeded does not implement net.Error")
    17  	}
    18  	if !err.Timeout() || !err.Temporary() {
    19  		t.Fatalf("Timeout() = %v, Temporary() = %v, want true, true", err.Timeout(), err.Temporary())
    20  	}
    21  }
    22  

View as plain text