vm: stringify InteropInterface stackitem type as InteropInterface
This commit is contained in:
parent
84629b0760
commit
a3285eae04
5 changed files with 7 additions and 7 deletions
|
@ -910,7 +910,7 @@ func (i *Interop) Value() interface{} {
|
||||||
|
|
||||||
// String implements stringer interface.
|
// String implements stringer interface.
|
||||||
func (i *Interop) String() string {
|
func (i *Interop) String() string {
|
||||||
return "Interop"
|
return "InteropInterface"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dup implements the Item interface.
|
// Dup implements the Item interface.
|
||||||
|
|
|
@ -126,7 +126,7 @@ var stringerTestCases = []struct {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: NewInterop(nil),
|
input: NewInterop(nil),
|
||||||
result: "Interop",
|
result: "InteropInterface",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: NewPointer(0, nil),
|
input: NewPointer(0, nil),
|
||||||
|
|
|
@ -299,7 +299,7 @@ func toJSONWithTypes(data []byte, item Item, seen map[Item]sliceNoPointer) ([]by
|
||||||
case Null:
|
case Null:
|
||||||
val = `{"type":"Any"}`
|
val = `{"type":"Any"}`
|
||||||
case *Interop:
|
case *Interop:
|
||||||
val = `{"type":"Interop"}`
|
val = `{"type":"InteropInterface"}`
|
||||||
default:
|
default:
|
||||||
val = `{"type":"` + item.Type().String() + `","value":`
|
val = `{"type":"` + item.Type().String() + `","value":`
|
||||||
hasValue = true
|
hasValue = true
|
||||||
|
|
|
@ -235,7 +235,7 @@ func TestToJSONWithTypes(t *testing.T) {
|
||||||
`{"type":"Map","value":[{"key":{"type":"Integer","value":"42"},` +
|
`{"type":"Map","value":[{"key":{"type":"Integer","value":"42"},` +
|
||||||
`"value":{"type":"Boolean","value":false}}]}`},
|
`"value":{"type":"Boolean","value":false}}]}`},
|
||||||
{"Interop", NewInterop(nil),
|
{"Interop", NewInterop(nil),
|
||||||
`{"type":"Interop"}`},
|
`{"type":"InteropInterface"}`},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
@ -385,7 +385,7 @@ func TestFromJSONWithTypes(t *testing.T) {
|
||||||
item Item
|
item Item
|
||||||
}{
|
}{
|
||||||
{"Pointer", `{"type":"Pointer","value":3}`, NewPointer(3, nil)},
|
{"Pointer", `{"type":"Pointer","value":3}`, NewPointer(3, nil)},
|
||||||
{"Interop", `{"type":"Interop"}`, NewInterop(nil)},
|
{"Interop", `{"type":"InteropInterface"}`, NewInterop(nil)},
|
||||||
{"Null", `{"type":"Any"}`, Null{}},
|
{"Null", `{"type":"Any"}`, Null{}},
|
||||||
{"Array", `{"type":"Array","value":[{"type":"Any"}]}`, NewArray([]Item{Null{}})},
|
{"Array", `{"type":"Array","value":[{"type":"Any"}]}`, NewArray([]Item{Null{}})},
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ func (t Type) String() string {
|
||||||
case MapT:
|
case MapT:
|
||||||
return "Map"
|
return "Map"
|
||||||
case InteropT:
|
case InteropT:
|
||||||
return "Interop"
|
return "InteropInterface"
|
||||||
default:
|
default:
|
||||||
return "INVALID"
|
return "INVALID"
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ func FromString(s string) (Type, error) {
|
||||||
return StructT, nil
|
return StructT, nil
|
||||||
case "Map":
|
case "Map":
|
||||||
return MapT, nil
|
return MapT, nil
|
||||||
case "Interop":
|
case "InteropInterface":
|
||||||
return InteropT, nil
|
return InteropT, nil
|
||||||
default:
|
default:
|
||||||
return 0xFF, ErrInvalidType
|
return 0xFF, ErrInvalidType
|
||||||
|
|
Loading…
Reference in a new issue