github.com/haraldrudell/parl@v0.4.176/pnet/linkaddr_test.go (about)

     1  /*
     2  © 2020–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package pnet
     7  
     8  import (
     9  	"net"
    10  	"testing"
    11  
    12  	"github.com/haraldrudell/parl/perrors"
    13  )
    14  
    15  func TestLinkAddr_Interface(t *testing.T) {
    16  	var a = &LinkAddr{Name: "a b"}
    17  
    18  	var netInterface *net.Interface
    19  	var isNoSuchInterface bool
    20  	var err error
    21  
    22  	netInterface, isNoSuchInterface, err = a.Interface()
    23  
    24  	if err == nil {
    25  		t.Fatal("LinkAddr.Interface no error")
    26  	}
    27  	if !isNoSuchInterface {
    28  		t.Errorf("isNoSuchInterface false: err: %q", perrors.Short(err))
    29  	}
    30  	if netInterface != nil {
    31  		t.Error("netInterface not nil")
    32  	}
    33  
    34  	// err: *errorglue.errorStack *fmt.wrapError *net.OpError *errors.errorString
    35  	//t.Logf("err: %s", errorglue.DumpChain(err))
    36  }