mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
src/reflect: add test for indirect array indexing
This commit is contained in:
@@ -14,4 +14,19 @@ func TestIndirectPointers(t *testing.T) {
|
||||
if ValueOf(a).Elem().Len() != 1 {
|
||||
t.Errorf("bad map length via reflect")
|
||||
}
|
||||
|
||||
var b struct {
|
||||
Decoded *[3]byte
|
||||
}
|
||||
|
||||
v1 := New(TypeOf(b.Decoded).Elem())
|
||||
|
||||
var bb [3]byte
|
||||
bb[0] = 0xaa
|
||||
|
||||
v1.Elem().Set(ValueOf(bb))
|
||||
|
||||
if v1.Elem().Index(0).Uint() != 0xaa {
|
||||
t.Errorf("bad indirect array index via reflect")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user