From e7e80fda648ecde060db3d70f105deef6adb4338 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 8 Jun 2022 18:51:27 +0300 Subject: [PATCH] core: move TestNativeGetMethod to the native package --- pkg/core/interop_system_core_test.go | 16 ---------------- pkg/core/native/contract_test.go | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 pkg/core/native/contract_test.go diff --git a/pkg/core/interop_system_core_test.go b/pkg/core/interop_system_core_test.go index d58c9fd52..2c7496c10 100644 --- a/pkg/core/interop_system_core_test.go +++ b/pkg/core/interop_system_core_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/nspcc-dev/neo-go/internal/random" - "github.com/nspcc-dev/neo-go/pkg/config" "github.com/nspcc-dev/neo-go/pkg/core/interop" "github.com/nspcc-dev/neo-go/pkg/core/interop/iterator" istorage "github.com/nspcc-dev/neo-go/pkg/core/interop/storage" @@ -424,18 +423,3 @@ func createVMAndContractState(t testing.TB) (*vm.VM, *state.Contract, *interop.C v, context, chain := createVM(t) return v, contractState, context, chain } - -// TestNativeGetMethod is needed to ensure that methods list has the same sorting -// rule as we expect inside the `ContractMD.GetMethod`. -func TestNativeGetMethod(t *testing.T) { - cfg := config.ProtocolConfiguration{P2PSigExtensions: true} - cs := native.NewContracts(cfg) - for _, c := range cs.Contracts { - t.Run(c.Metadata().Name, func(t *testing.T) { - for _, m := range c.Metadata().Methods { - _, ok := c.Metadata().GetMethod(m.MD.Name, len(m.MD.Parameters)) - require.True(t, ok) - } - }) - } -} diff --git a/pkg/core/native/contract_test.go b/pkg/core/native/contract_test.go new file mode 100644 index 000000000..3e61320f1 --- /dev/null +++ b/pkg/core/native/contract_test.go @@ -0,0 +1,23 @@ +package native + +import ( + "testing" + + "github.com/nspcc-dev/neo-go/pkg/config" + "github.com/stretchr/testify/require" +) + +// TestNativeGetMethod is needed to ensure that methods list has the same sorting +// rule as we expect inside the `ContractMD.GetMethod`. +func TestNativeGetMethod(t *testing.T) { + cfg := config.ProtocolConfiguration{P2PSigExtensions: true} + cs := NewContracts(cfg) + for _, c := range cs.Contracts { + t.Run(c.Metadata().Name, func(t *testing.T) { + for _, m := range c.Metadata().Methods { + _, ok := c.Metadata().GetMethod(m.MD.Name, len(m.MD.Parameters)) + require.True(t, ok) + } + }) + } +}