From b4c0fcfaadb6a8a1b2b6fb8524e454ea878a0f65 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 11 Aug 2023 16:07:02 +0300 Subject: [PATCH] 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 --- cli/smartcontract/generate_test.go | 20 +++++++++---------- .../invalid1}/invalid.go | 2 +- .../invalid1}/invalid.yml | 0 .../invalid2}/invalid.go | 2 +- .../invalid2}/invalid.yml | 0 .../invalid3}/invalid.go | 2 +- .../invalid3}/invalid.yml | 0 .../invalid4}/invalid.go | 2 +- .../invalid4}/invalid.yml | 0 .../invalid5}/invalid.go | 2 +- .../invalid5}/invalid.yml | 6 +++--- .../notifications/config.yml | 0 .../notifications/config_extended.yml | 0 .../notifications/config_guessed.yml | 0 .../notifications/notifications.go | 0 .../notifications/rpcbindings.out | 0 .../notifications/rpcbindings_extended.out | 0 .../notifications/rpcbindings_guessed.out | 0 .../{ => rpcbindings}/structs/config.yml | 0 .../{ => rpcbindings}/structs/rpcbindings.out | 0 .../structs/rpcbindings_dynamic_hash.out | 0 .../{ => rpcbindings}/structs/structs.go | 0 .../{ => rpcbindings}/types/config.yml | 0 .../{ => rpcbindings}/types/rpcbindings.out | 0 .../types/rpcbindings_dynamic_hash.out | 0 .../testdata/{ => rpcbindings}/types/types.go | 0 26 files changed, 18 insertions(+), 18 deletions(-) rename cli/smartcontract/testdata/{invalid5 => rpcbindings/invalid1}/invalid.go (86%) rename cli/smartcontract/testdata/{invalid5 => rpcbindings/invalid1}/invalid.yml (100%) rename cli/smartcontract/testdata/{invalid6 => rpcbindings/invalid2}/invalid.go (87%) rename cli/smartcontract/testdata/{invalid6 => rpcbindings/invalid2}/invalid.yml (100%) rename cli/smartcontract/testdata/{invalid7 => rpcbindings/invalid3}/invalid.go (86%) rename cli/smartcontract/testdata/{invalid7 => rpcbindings/invalid3}/invalid.yml (100%) rename cli/smartcontract/testdata/{invalid8 => rpcbindings/invalid4}/invalid.go (95%) rename cli/smartcontract/testdata/{invalid8 => rpcbindings/invalid4}/invalid.yml (100%) rename cli/smartcontract/testdata/{invalid9 => rpcbindings/invalid5}/invalid.go (92%) rename cli/smartcontract/testdata/{invalid9 => rpcbindings/invalid5}/invalid.yml (72%) rename cli/smartcontract/testdata/{ => rpcbindings}/notifications/config.yml (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/notifications/config_extended.yml (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/notifications/config_guessed.yml (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/notifications/notifications.go (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/notifications/rpcbindings.out (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/notifications/rpcbindings_extended.out (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/notifications/rpcbindings_guessed.out (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/structs/config.yml (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/structs/rpcbindings.out (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/structs/rpcbindings_dynamic_hash.out (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/structs/structs.go (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/types/config.yml (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/types/rpcbindings.out (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/types/rpcbindings_dynamic_hash.out (100%) rename cli/smartcontract/testdata/{ => rpcbindings}/types/types.go (100%) diff --git a/cli/smartcontract/generate_test.go b/cli/smartcontract/generate_test.go index be3cd313e..7f46e826a 100644 --- a/cli/smartcontract/generate_test.go +++ b/cli/smartcontract/generate_test.go @@ -437,12 +437,12 @@ func TestAssistedRPCBindings(t *testing.T) { } for _, hasDefinedHash := range []bool{true, false} { - checkBinding(filepath.Join("testdata", "types"), hasDefinedHash, false) - checkBinding(filepath.Join("testdata", "structs"), hasDefinedHash, false) + checkBinding(filepath.Join("testdata", "rpcbindings", "types"), hasDefinedHash, false) + checkBinding(filepath.Join("testdata", "rpcbindings", "structs"), hasDefinedHash, false) } - checkBinding(filepath.Join("testdata", "notifications"), true, false) - checkBinding(filepath.Join("testdata", "notifications"), true, false, "_extended") - checkBinding(filepath.Join("testdata", "notifications"), true, true, "_guessed") + checkBinding(filepath.Join("testdata", "rpcbindings", "notifications"), true, false) + checkBinding(filepath.Join("testdata", "rpcbindings", "notifications"), true, false, "_extended") + checkBinding(filepath.Join("testdata", "rpcbindings", "notifications"), true, true, "_guessed") require.False(t, rewriteExpectedOutputs) } @@ -540,10 +540,10 @@ func TestCompile_GuessEventTypes(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) { - 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 @@ -552,13 +552,13 @@ func TestCompile_GuessEventTypes(t *testing.T) { // 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? 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) { - 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) { - 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`") }) } diff --git a/cli/smartcontract/testdata/invalid5/invalid.go b/cli/smartcontract/testdata/rpcbindings/invalid1/invalid.go similarity index 86% rename from cli/smartcontract/testdata/invalid5/invalid.go rename to cli/smartcontract/testdata/rpcbindings/invalid1/invalid.go index 0cae2ed71..821a7d8db 100644 --- a/cli/smartcontract/testdata/invalid5/invalid.go +++ b/cli/smartcontract/testdata/rpcbindings/invalid1/invalid.go @@ -1,4 +1,4 @@ -package invalid5 +package invalid1 import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" diff --git a/cli/smartcontract/testdata/invalid5/invalid.yml b/cli/smartcontract/testdata/rpcbindings/invalid1/invalid.yml similarity index 100% rename from cli/smartcontract/testdata/invalid5/invalid.yml rename to cli/smartcontract/testdata/rpcbindings/invalid1/invalid.yml diff --git a/cli/smartcontract/testdata/invalid6/invalid.go b/cli/smartcontract/testdata/rpcbindings/invalid2/invalid.go similarity index 87% rename from cli/smartcontract/testdata/invalid6/invalid.go rename to cli/smartcontract/testdata/rpcbindings/invalid2/invalid.go index dd3a3ecdd..6aa771c26 100644 --- a/cli/smartcontract/testdata/invalid6/invalid.go +++ b/cli/smartcontract/testdata/rpcbindings/invalid2/invalid.go @@ -1,4 +1,4 @@ -package invalid6 +package invalid2 import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" diff --git a/cli/smartcontract/testdata/invalid6/invalid.yml b/cli/smartcontract/testdata/rpcbindings/invalid2/invalid.yml similarity index 100% rename from cli/smartcontract/testdata/invalid6/invalid.yml rename to cli/smartcontract/testdata/rpcbindings/invalid2/invalid.yml diff --git a/cli/smartcontract/testdata/invalid7/invalid.go b/cli/smartcontract/testdata/rpcbindings/invalid3/invalid.go similarity index 86% rename from cli/smartcontract/testdata/invalid7/invalid.go rename to cli/smartcontract/testdata/rpcbindings/invalid3/invalid.go index 41bc20c47..7f9298f6f 100644 --- a/cli/smartcontract/testdata/invalid7/invalid.go +++ b/cli/smartcontract/testdata/rpcbindings/invalid3/invalid.go @@ -1,4 +1,4 @@ -package invalid7 +package invalid3 import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" diff --git a/cli/smartcontract/testdata/invalid7/invalid.yml b/cli/smartcontract/testdata/rpcbindings/invalid3/invalid.yml similarity index 100% rename from cli/smartcontract/testdata/invalid7/invalid.yml rename to cli/smartcontract/testdata/rpcbindings/invalid3/invalid.yml diff --git a/cli/smartcontract/testdata/invalid8/invalid.go b/cli/smartcontract/testdata/rpcbindings/invalid4/invalid.go similarity index 95% rename from cli/smartcontract/testdata/invalid8/invalid.go rename to cli/smartcontract/testdata/rpcbindings/invalid4/invalid.go index dba9173ca..70f887be1 100644 --- a/cli/smartcontract/testdata/invalid8/invalid.go +++ b/cli/smartcontract/testdata/rpcbindings/invalid4/invalid.go @@ -1,4 +1,4 @@ -package invalid8 +package invalid4 import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" diff --git a/cli/smartcontract/testdata/invalid8/invalid.yml b/cli/smartcontract/testdata/rpcbindings/invalid4/invalid.yml similarity index 100% rename from cli/smartcontract/testdata/invalid8/invalid.yml rename to cli/smartcontract/testdata/rpcbindings/invalid4/invalid.yml diff --git a/cli/smartcontract/testdata/invalid9/invalid.go b/cli/smartcontract/testdata/rpcbindings/invalid5/invalid.go similarity index 92% rename from cli/smartcontract/testdata/invalid9/invalid.go rename to cli/smartcontract/testdata/rpcbindings/invalid5/invalid.go index 5036bca9f..3d31565ca 100644 --- a/cli/smartcontract/testdata/invalid9/invalid.go +++ b/cli/smartcontract/testdata/rpcbindings/invalid5/invalid.go @@ -1,4 +1,4 @@ -package invalid9 +package invalid5 import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" diff --git a/cli/smartcontract/testdata/invalid9/invalid.yml b/cli/smartcontract/testdata/rpcbindings/invalid5/invalid.yml similarity index 72% rename from cli/smartcontract/testdata/invalid9/invalid.yml rename to cli/smartcontract/testdata/rpcbindings/invalid5/invalid.yml index 40bbf66db..ccd05f4c2 100644 --- a/cli/smartcontract/testdata/invalid9/invalid.yml +++ b/cli/smartcontract/testdata/rpcbindings/invalid5/invalid.yml @@ -6,11 +6,11 @@ events: type: Array extendedtype: base: Array - name: invalid9.NamedStruct + name: invalid5.NamedStruct namedtypes: - invalid9.NamedStruct: + invalid5.NamedStruct: base: Array - name: invalid9.NamedStruct + name: invalid5.NamedStruct fields: - field: SomeInt base: Integer diff --git a/cli/smartcontract/testdata/notifications/config.yml b/cli/smartcontract/testdata/rpcbindings/notifications/config.yml similarity index 100% rename from cli/smartcontract/testdata/notifications/config.yml rename to cli/smartcontract/testdata/rpcbindings/notifications/config.yml diff --git a/cli/smartcontract/testdata/notifications/config_extended.yml b/cli/smartcontract/testdata/rpcbindings/notifications/config_extended.yml similarity index 100% rename from cli/smartcontract/testdata/notifications/config_extended.yml rename to cli/smartcontract/testdata/rpcbindings/notifications/config_extended.yml diff --git a/cli/smartcontract/testdata/notifications/config_guessed.yml b/cli/smartcontract/testdata/rpcbindings/notifications/config_guessed.yml similarity index 100% rename from cli/smartcontract/testdata/notifications/config_guessed.yml rename to cli/smartcontract/testdata/rpcbindings/notifications/config_guessed.yml diff --git a/cli/smartcontract/testdata/notifications/notifications.go b/cli/smartcontract/testdata/rpcbindings/notifications/notifications.go similarity index 100% rename from cli/smartcontract/testdata/notifications/notifications.go rename to cli/smartcontract/testdata/rpcbindings/notifications/notifications.go diff --git a/cli/smartcontract/testdata/notifications/rpcbindings.out b/cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings.out similarity index 100% rename from cli/smartcontract/testdata/notifications/rpcbindings.out rename to cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings.out diff --git a/cli/smartcontract/testdata/notifications/rpcbindings_extended.out b/cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings_extended.out similarity index 100% rename from cli/smartcontract/testdata/notifications/rpcbindings_extended.out rename to cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings_extended.out diff --git a/cli/smartcontract/testdata/notifications/rpcbindings_guessed.out b/cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings_guessed.out similarity index 100% rename from cli/smartcontract/testdata/notifications/rpcbindings_guessed.out rename to cli/smartcontract/testdata/rpcbindings/notifications/rpcbindings_guessed.out diff --git a/cli/smartcontract/testdata/structs/config.yml b/cli/smartcontract/testdata/rpcbindings/structs/config.yml similarity index 100% rename from cli/smartcontract/testdata/structs/config.yml rename to cli/smartcontract/testdata/rpcbindings/structs/config.yml diff --git a/cli/smartcontract/testdata/structs/rpcbindings.out b/cli/smartcontract/testdata/rpcbindings/structs/rpcbindings.out similarity index 100% rename from cli/smartcontract/testdata/structs/rpcbindings.out rename to cli/smartcontract/testdata/rpcbindings/structs/rpcbindings.out diff --git a/cli/smartcontract/testdata/structs/rpcbindings_dynamic_hash.out b/cli/smartcontract/testdata/rpcbindings/structs/rpcbindings_dynamic_hash.out similarity index 100% rename from cli/smartcontract/testdata/structs/rpcbindings_dynamic_hash.out rename to cli/smartcontract/testdata/rpcbindings/structs/rpcbindings_dynamic_hash.out diff --git a/cli/smartcontract/testdata/structs/structs.go b/cli/smartcontract/testdata/rpcbindings/structs/structs.go similarity index 100% rename from cli/smartcontract/testdata/structs/structs.go rename to cli/smartcontract/testdata/rpcbindings/structs/structs.go diff --git a/cli/smartcontract/testdata/types/config.yml b/cli/smartcontract/testdata/rpcbindings/types/config.yml similarity index 100% rename from cli/smartcontract/testdata/types/config.yml rename to cli/smartcontract/testdata/rpcbindings/types/config.yml diff --git a/cli/smartcontract/testdata/types/rpcbindings.out b/cli/smartcontract/testdata/rpcbindings/types/rpcbindings.out similarity index 100% rename from cli/smartcontract/testdata/types/rpcbindings.out rename to cli/smartcontract/testdata/rpcbindings/types/rpcbindings.out diff --git a/cli/smartcontract/testdata/types/rpcbindings_dynamic_hash.out b/cli/smartcontract/testdata/rpcbindings/types/rpcbindings_dynamic_hash.out similarity index 100% rename from cli/smartcontract/testdata/types/rpcbindings_dynamic_hash.out rename to cli/smartcontract/testdata/rpcbindings/types/rpcbindings_dynamic_hash.out diff --git a/cli/smartcontract/testdata/types/types.go b/cli/smartcontract/testdata/rpcbindings/types/types.go similarity index 100% rename from cli/smartcontract/testdata/types/types.go rename to cli/smartcontract/testdata/rpcbindings/types/types.go