github.com/decred/dcrlnd@v0.7.6/lnwallet/errors_test.go (about) 1 package lnwallet 2 3 import ( 4 "errors" 5 "testing" 6 7 "github.com/decred/dcrd/chaincfg/chainhash" 8 "github.com/decred/dcrd/wire" 9 "github.com/stretchr/testify/require" 10 ) 11 12 func TestErrUtxoAlreadySpent(t *testing.T) { 13 err1 := ErrUtxoAlreadySpent{ 14 PrevOutPoint: wire.OutPoint{Hash: chainhash.Hash{0: 0x01}, Index: 1}, 15 SpendingOutPoint: wire.OutPoint{Hash: chainhash.Hash{0: 0x02}, Index: 2}, 16 } 17 require.True(t, errors.Is(err1, ErrUtxoAlreadySpent{})) 18 var err2 ErrUtxoAlreadySpent 19 require.True(t, errors.As(err1, &err2)) 20 require.Equal(t, err1, err2) 21 22 }