github.com/gagliardetto/solana-go@v1.11.0/registry_test.go (about)

     1  package solana
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestRegisterInstructionDecoder(t *testing.T) {
    10  
    11  	decoder := func(instructionAccounts []*AccountMeta, data []byte) (interface{}, error) {
    12  		return nil, nil
    13  	}
    14  	decoderAnother := func(instructionAccounts []*AccountMeta, data []byte) (interface{}, error) {
    15  		return nil, nil
    16  	}
    17  
    18  	assert.NotPanics(t, func() {
    19  		RegisterInstructionDecoder(BPFLoaderProgramID, decoder)
    20  	})
    21  	assert.NotPanics(t, func() {
    22  		RegisterInstructionDecoder(BPFLoaderProgramID, decoder)
    23  	})
    24  	assert.Panics(t, func() {
    25  		RegisterInstructionDecoder(BPFLoaderProgramID, decoderAnother)
    26  	})
    27  }