github.com/zaolin/u-root@v0.0.0-20200428085104-64aaafd46c6d/pkg/pci/pci_linux_test.go (about) 1 // Copyright 2012-2017 the u-root 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 pci 6 7 import ( 8 "testing" 9 ) 10 11 func TestNewBusReaderNoGlob(t *testing.T) { 12 n, err := NewBusReader() 13 if err != nil { 14 t.Fatal(err) 15 } 16 g, err := NewBusReader("*", "*") 17 if err != nil { 18 t.Fatal(err) 19 } 20 if len(n.(*bus).Devices) != len(g.(*bus).Devices) { 21 t.Fatalf("Got %v, want %v", len(n.(*bus).Devices), len(g.(*bus).Devices)) 22 } 23 24 for i := range n.(*bus).Devices { 25 if n.(*bus).Devices[i] != g.(*bus).Devices[i] { 26 t.Errorf("%d: got %q, want %q", i, n.(*bus).Devices[i], g.(*bus).Devices[i]) 27 } 28 } 29 }