solana-go/registry_test.go

28 lines
641 B
Go

package solana
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRegisterInstructionDecoder(t *testing.T) {
decoder := func(instructionAccounts []*AccountMeta, data []byte) (interface{}, error) {
return nil, nil
}
decoderAnother := func(instructionAccounts []*AccountMeta, data []byte) (interface{}, error) {
return nil, nil
}
assert.NotPanics(t, func() {
RegisterInstructionDecoder(BPFLoaderProgramID, decoder)
})
assert.NotPanics(t, func() {
RegisterInstructionDecoder(BPFLoaderProgramID, decoder)
})
assert.Panics(t, func() {
RegisterInstructionDecoder(BPFLoaderProgramID, decoderAnother)
})
}