diff --git a/dif/readout_test.go b/dif/readout_test.go index 8667fe2d94c90beeff1b4a04d807fda14a1718cc..8fe739104223164e40620fcd277591b1181a6afd 100644 --- a/dif/readout_test.go +++ b/dif/readout_test.go @@ -12,6 +12,7 @@ import ( "github.com/go-daq/tdaq/log" "github.com/ziutek/ftdi" + "golang.org/x/xerrors" ) func ftdiOpenTest(vid, pid uint16) (ftdiDevice, error) { @@ -24,6 +25,19 @@ func TestReadout(t *testing.T) { ftdiOpen = ftdiOpenImpl }() + { + const name = "FT101xxx" + rdo, err := NewReadout(name, 0x6014, nil) + if err == nil { + rdo.close() + t.Fatalf("expected an error") + } + want := xerrors.Errorf("could not find DIF-id from %q: %s", name, xerrors.New("expected integer")) + if got, want := err.Error(), want.Error(); got != want { + t.Fatalf("invalid error:\ngot= %v\nwant=%v", got, want) + } + } + const ( name = "FT101042" prodID = 0x6014