github.com/MetalBlockchain/metalgo@v1.11.9/vms/components/verify/verification_test.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package verify 5 6 import ( 7 "errors" 8 "testing" 9 10 "github.com/stretchr/testify/require" 11 ) 12 13 var errTest = errors.New("non-nil error") 14 15 type testVerifiable struct{ err error } 16 17 func (v testVerifiable) Verify() error { 18 return v.err 19 } 20 21 func TestAllNil(t *testing.T) { 22 require.NoError(t, All( 23 testVerifiable{}, 24 testVerifiable{}, 25 )) 26 } 27 28 func TestAllError(t *testing.T) { 29 err := All( 30 testVerifiable{}, 31 testVerifiable{err: errTest}, 32 ) 33 require.ErrorIs(t, err, errTest) 34 }