forked from TrueCloudLab/restic
Vendor dependencies with dep
This commit is contained in:
parent
df8a5792f1
commit
91edebf1fe
1691 changed files with 466360 additions and 0 deletions
63
vendor/golang.org/x/net/lif/link_test.go
generated
vendored
Normal file
63
vendor/golang.org/x/net/lif/link_test.go
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build solaris
|
||||
|
||||
package lif
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func (ll *Link) String() string {
|
||||
return fmt.Sprintf("name=%s index=%d type=%d flags=%#x mtu=%d addr=%v", ll.Name, ll.Index, ll.Type, ll.Flags, ll.MTU, llAddr(ll.Addr))
|
||||
}
|
||||
|
||||
type linkPack struct {
|
||||
af int
|
||||
lls []Link
|
||||
}
|
||||
|
||||
func linkPacks() ([]linkPack, error) {
|
||||
var lastErr error
|
||||
var lps []linkPack
|
||||
for _, af := range [...]int{sysAF_UNSPEC, sysAF_INET, sysAF_INET6} {
|
||||
lls, err := Links(af, "")
|
||||
if err != nil {
|
||||
lastErr = err
|
||||
continue
|
||||
}
|
||||
lps = append(lps, linkPack{af: af, lls: lls})
|
||||
}
|
||||
return lps, lastErr
|
||||
}
|
||||
|
||||
func TestLinks(t *testing.T) {
|
||||
lps, err := linkPacks()
|
||||
if len(lps) == 0 && err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, lp := range lps {
|
||||
n := 0
|
||||
for _, sll := range lp.lls {
|
||||
lls, err := Links(lp.af, sll.Name)
|
||||
if err != nil {
|
||||
t.Fatal(lp.af, sll.Name, err)
|
||||
}
|
||||
for _, ll := range lls {
|
||||
if ll.Name != sll.Name || ll.Index != sll.Index {
|
||||
t.Errorf("af=%s got %v; want %v", addrFamily(lp.af), &ll, &sll)
|
||||
continue
|
||||
}
|
||||
t.Logf("af=%s name=%s %v", addrFamily(lp.af), sll.Name, &ll)
|
||||
n++
|
||||
}
|
||||
}
|
||||
if n != len(lp.lls) {
|
||||
t.Errorf("af=%s got %d; want %d", addrFamily(lp.af), n, len(lp.lls))
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue