cli: add tests for Storage.Find invocations
It returns values of different types we better be sure that compiler emits correct code.
This commit is contained in:
parent
9b1a7021ba
commit
50d515a3e5
2 changed files with 53 additions and 0 deletions
15
cli/testdata/deploy/main.go
vendored
15
cli/testdata/deploy/main.go
vendored
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/cli/testdata/deploy/sub"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
||||
)
|
||||
|
@ -46,3 +47,17 @@ func GetValue() string {
|
|||
val2 := storage.Get(ctx, sub.Key)
|
||||
return val1.(string) + "|" + val2.(string)
|
||||
}
|
||||
|
||||
// TestFind finds items with the specified prefix.
|
||||
func TestFind(f storage.FindFlags) []interface{} {
|
||||
ctx := storage.GetContext()
|
||||
storage.Put(ctx, "findkey1", "value1")
|
||||
storage.Put(ctx, "findkey2", "value2")
|
||||
|
||||
var result []interface{}
|
||||
iter := storage.Find(ctx, "findkey", f)
|
||||
for iterator.Next(iter) {
|
||||
result = append(result, iterator.Value(iter))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue