Skip to content

Commit

Permalink
vm: stringify InteropInterface stackitem type as InteropInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaShaleva committed May 25, 2022
1 parent 84629b0 commit a3285ea
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/vm/stackitem/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ func (i *Interop) Value() interface{} {

// String implements stringer interface.
func (i *Interop) String() string {
return "Interop"
return "InteropInterface"
}

// Dup implements the Item interface.
Expand Down
2 changes: 1 addition & 1 deletion pkg/vm/stackitem/item_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var stringerTestCases = []struct {
},
{
input: NewInterop(nil),
result: "Interop",
result: "InteropInterface",
},
{
input: NewPointer(0, nil),
Expand Down
2 changes: 1 addition & 1 deletion pkg/vm/stackitem/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func toJSONWithTypes(data []byte, item Item, seen map[Item]sliceNoPointer) ([]by
case Null:
val = `{"type":"Any"}`
case *Interop:
val = `{"type":"Interop"}`
val = `{"type":"InteropInterface"}`
default:
val = `{"type":"` + item.Type().String() + `","value":`
hasValue = true
Expand Down
4 changes: 2 additions & 2 deletions pkg/vm/stackitem/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func TestToJSONWithTypes(t *testing.T) {
`{"type":"Map","value":[{"key":{"type":"Integer","value":"42"},` +
`"value":{"type":"Boolean","value":false}}]}`},
{"Interop", NewInterop(nil),
`{"type":"Interop"}`},
`{"type":"InteropInterface"}`},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
Expand Down Expand Up @@ -385,7 +385,7 @@ func TestFromJSONWithTypes(t *testing.T) {
item Item
}{
{"Pointer", `{"type":"Pointer","value":3}`, NewPointer(3, nil)},
{"Interop", `{"type":"Interop"}`, NewInterop(nil)},
{"Interop", `{"type":"InteropInterface"}`, NewInterop(nil)},
{"Null", `{"type":"Any"}`, Null{}},
{"Array", `{"type":"Array","value":[{"type":"Any"}]}`, NewArray([]Item{Null{}})},
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/vm/stackitem/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (t Type) String() string {
case MapT:
return "Map"
case InteropT:
return "Interop"
return "InteropInterface"
default:
return "INVALID"
}
Expand Down Expand Up @@ -82,7 +82,7 @@ func FromString(s string) (Type, error) {
return StructT, nil
case "Map":
return MapT, nil
case "Interop":
case "InteropInterface":
return InteropT, nil
default:
return 0xFF, ErrInvalidType
Expand Down

0 comments on commit a3285ea

Please sign in to comment.