mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
Fix append for bytearrays (#64)
This commit is contained in:
parent
941bd7e728
commit
5b5a7106c1
3 changed files with 19 additions and 1 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.39.0
|
||||
0.39.1
|
||||
|
|
|
@ -225,6 +225,21 @@ func TestIfUnaryInvert(t *testing.T) {
|
|||
eval(t, src, big.NewInt(0))
|
||||
}
|
||||
|
||||
func TestAppendByte(t *testing.T) {
|
||||
src := `
|
||||
package foo
|
||||
func Main() []byte {
|
||||
arr := []byte{0x00, 0x01, 0x02}
|
||||
arr = append(arr, 0x03)
|
||||
arr = append(arr, 0x04)
|
||||
arr = append(arr, 0x05)
|
||||
arr = append(arr, 0x06)
|
||||
return arr
|
||||
}
|
||||
`
|
||||
eval(t, src, []uint8{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06})
|
||||
}
|
||||
|
||||
func TestAppendString(t *testing.T) {
|
||||
src := `
|
||||
package foo
|
||||
|
|
|
@ -483,6 +483,9 @@ func (v *VM) execute(ctx *Context, op Opcode) {
|
|||
arr := t.Value().([]StackItem)
|
||||
arr = append(arr, itemElem.value)
|
||||
v.estack.PushVal(arr)
|
||||
case *ByteArrayItem:
|
||||
newVal := append(t.value, itemElem.value.Value().([]byte)...)
|
||||
v.estack.PushVal(newVal)
|
||||
default:
|
||||
panic("APPEND: not of underlying type Array")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue