mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 23:13:40 +00:00
reflect: add MapIndex()
This commit is contained in:
@@ -44,4 +44,13 @@ func TestMap(t *testing.T) {
|
||||
if got, want := mtyp.Elem().Kind().String(), "int"; got != want {
|
||||
t.Errorf("m.Elem().String()=%q, want %q", got, want)
|
||||
}
|
||||
|
||||
m["foo"] = 2
|
||||
|
||||
mref := ValueOf(m)
|
||||
two := mref.MapIndex(ValueOf("foo"))
|
||||
|
||||
if got, want := two.Interface().(int), 2; got != want {
|
||||
t.Errorf("MapIndex(`foo`)=%v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user