cli: move RPC bindings related testdata to a separate folder

It helps us to keep the index clean and ordered. When some new RPC binding
test should be added, we don't need to search for a suitable place for it.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-08-11 16:07:02 +03:00
parent b2f84c83b3
commit b4c0fcfaad
26 changed files with 18 additions and 18 deletions

View file

@ -437,12 +437,12 @@ func TestAssistedRPCBindings(t *testing.T) {
} }
for _, hasDefinedHash := range []bool{true, false} { for _, hasDefinedHash := range []bool{true, false} {
checkBinding(filepath.Join("testdata", "types"), hasDefinedHash, false) checkBinding(filepath.Join("testdata", "rpcbindings", "types"), hasDefinedHash, false)
checkBinding(filepath.Join("testdata", "structs"), hasDefinedHash, false) checkBinding(filepath.Join("testdata", "rpcbindings", "structs"), hasDefinedHash, false)
} }
checkBinding(filepath.Join("testdata", "notifications"), true, false) checkBinding(filepath.Join("testdata", "rpcbindings", "notifications"), true, false)
checkBinding(filepath.Join("testdata", "notifications"), true, false, "_extended") checkBinding(filepath.Join("testdata", "rpcbindings", "notifications"), true, false, "_extended")
checkBinding(filepath.Join("testdata", "notifications"), true, true, "_guessed") checkBinding(filepath.Join("testdata", "rpcbindings", "notifications"), true, true, "_guessed")
require.False(t, rewriteExpectedOutputs) require.False(t, rewriteExpectedOutputs)
} }
@ -540,10 +540,10 @@ func TestCompile_GuessEventTypes(t *testing.T) {
} }
t.Run("not declared in manifest", func(t *testing.T) { t.Run("not declared in manifest", func(t *testing.T) {
check(t, filepath.Join("testdata", "invalid5"), "inconsistent usages of event `Non declared event`: not declared in the contract config") check(t, filepath.Join("testdata", "rpcbindings", "invalid1"), "inconsistent usages of event `Non declared event`: not declared in the contract config")
}) })
t.Run("invalid number of params", func(t *testing.T) { t.Run("invalid number of params", func(t *testing.T) {
check(t, filepath.Join("testdata", "invalid6"), "inconsistent usages of event `SomeEvent` against config: number of params mismatch: 2 vs 1") check(t, filepath.Join("testdata", "rpcbindings", "invalid2"), "inconsistent usages of event `SomeEvent` against config: number of params mismatch: 2 vs 1")
}) })
/* /*
// TODO: this on is a controversial one. If event information is provided in the config file, then conversion code // TODO: this on is a controversial one. If event information is provided in the config file, then conversion code
@ -552,13 +552,13 @@ func TestCompile_GuessEventTypes(t *testing.T) {
// Thus, this testcase is always failing (no compilation error occures). // Thus, this testcase is always failing (no compilation error occures).
// Question: do we want to compare `RealType` of the emitted parameter with the one expected in the manifest? // Question: do we want to compare `RealType` of the emitted parameter with the one expected in the manifest?
t.Run("SC parameter type mismatch", func(t *testing.T) { t.Run("SC parameter type mismatch", func(t *testing.T) {
check(t, filepath.Join("testdata", "invalid7"), "inconsistent usages of event `SomeEvent` against config: number of params mismatch: 2 vs 1") check(t, filepath.Join("testdata", "rpcbindings", "invalid3"), "inconsistent usages of event `SomeEvent` against config: number of params mismatch: 2 vs 1")
}) })
*/ */
t.Run("extended types mismatch", func(t *testing.T) { t.Run("extended types mismatch", func(t *testing.T) {
check(t, filepath.Join("testdata", "invalid8"), "inconsistent usages of event `SomeEvent`: extended type of param #0 mismatch") check(t, filepath.Join("testdata", "rpcbindings", "invalid4"), "inconsistent usages of event `SomeEvent`: extended type of param #0 mismatch")
}) })
t.Run("named types redeclare", func(t *testing.T) { t.Run("named types redeclare", func(t *testing.T) {
check(t, filepath.Join("testdata", "invalid9"), "configured declared named type intersects with the contract's one: `invalid9.NamedStruct`") check(t, filepath.Join("testdata", "rpcbindings", "invalid5"), "configured declared named type intersects with the contract's one: `invalid5.NamedStruct`")
}) })
} }

View file

@ -1,4 +1,4 @@
package invalid5 package invalid1
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"

View file

@ -1,4 +1,4 @@
package invalid6 package invalid2
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"

View file

@ -1,4 +1,4 @@
package invalid7 package invalid3
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"

View file

@ -1,4 +1,4 @@
package invalid8 package invalid4
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"

View file

@ -1,4 +1,4 @@
package invalid9 package invalid5
import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" import "github.com/nspcc-dev/neo-go/pkg/interop/runtime"

View file

@ -6,11 +6,11 @@ events:
type: Array type: Array
extendedtype: extendedtype:
base: Array base: Array
name: invalid9.NamedStruct name: invalid5.NamedStruct
namedtypes: namedtypes:
invalid9.NamedStruct: invalid5.NamedStruct:
base: Array base: Array
name: invalid9.NamedStruct name: invalid5.NamedStruct
fields: fields:
- field: SomeInt - field: SomeInt
base: Integer base: Integer