stackitem: change ByteArray type to ByteString
Adjust only string representation. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
87119da2f7
commit
b53f0257f5
9 changed files with 36 additions and 36 deletions
|
@ -32,11 +32,11 @@ var marshalJSONTestCases = []struct {
|
|||
},
|
||||
{
|
||||
input: Parameter{Type: ByteArrayType, Value: []byte{0x01, 0x02, 0x03}},
|
||||
result: `{"type":"ByteArray","value":"` + hexToBase64("010203") + `"}`,
|
||||
result: `{"type":"ByteString","value":"` + hexToBase64("010203") + `"}`,
|
||||
},
|
||||
{
|
||||
input: Parameter{Type: ByteArrayType},
|
||||
result: `{"type":"ByteArray","value":null}`,
|
||||
result: `{"type":"ByteString","value":null}`,
|
||||
},
|
||||
{
|
||||
input: Parameter{
|
||||
|
@ -68,8 +68,8 @@ var marshalJSONTestCases = []struct {
|
|||
}},
|
||||
},
|
||||
},
|
||||
result: `{"type":"Array","value":[{"type":"ByteArray","value":"` + hexToBase64("0102") + `"},{"type":"Array","value":[` +
|
||||
`{"type":"ByteArray","value":"` + hexToBase64("030201") + `"},{"type":"ByteArray","value":"` + hexToBase64("070809") + `"}]}]}`,
|
||||
result: `{"type":"Array","value":[{"type":"ByteString","value":"` + hexToBase64("0102") + `"},{"type":"Array","value":[` +
|
||||
`{"type":"ByteString","value":"` + hexToBase64("030201") + `"},{"type":"ByteString","value":"` + hexToBase64("070809") + `"}]}]}`,
|
||||
},
|
||||
{
|
||||
input: Parameter{
|
||||
|
@ -185,7 +185,7 @@ var unmarshalJSONTestCases = []struct {
|
|||
result: Parameter{Type: IntegerType, Value: int64(12345)},
|
||||
},
|
||||
{
|
||||
input: `{"type":"ByteArray","value":"` + hexToBase64("010203") + `"}`,
|
||||
input: `{"type":"ByteString","value":"` + hexToBase64("010203") + `"}`,
|
||||
result: Parameter{Type: ByteArrayType, Value: []byte{0x01, 0x02, 0x03}},
|
||||
},
|
||||
{
|
||||
|
@ -288,9 +288,9 @@ var unmarshalJSONTestCases = []struct {
|
|||
}
|
||||
|
||||
var unmarshalJSONErrorCases = []string{
|
||||
`{"type": "ByteArray","value":`, // incorrect JSON
|
||||
`{"type": "ByteArray","value":1}`, // incorrect Value
|
||||
`{"type": "ByteArray","value":"12^"}`, // incorrect ByteArray value
|
||||
`{"type": "ByteString","value":`, // incorrect JSON
|
||||
`{"type": "ByteString","value":1}`, // incorrect Value
|
||||
`{"type": "ByteString","value":"12^"}`, // incorrect ByteArray value
|
||||
`{"type": "String","value":`, // incorrect JSON
|
||||
`{"type": "String","value":1}`, // incorrect Value
|
||||
`{"type": "Integer","value": "nn"}`, // incorrect Integer value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue