mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
reflect: add support for remaining map types
This commit is contained in:
committed by
Damian Gryski
parent
a6084767b3
commit
69e5c5088d
@@ -115,6 +115,23 @@ func TestMap(t *testing.T) {
|
||||
if m2["foo"] != 2 {
|
||||
t.Errorf("MakeMap failed to create map")
|
||||
}
|
||||
|
||||
type stringint struct {
|
||||
s string
|
||||
i int
|
||||
}
|
||||
|
||||
simap := make(map[stringint]int)
|
||||
|
||||
refsimap := MakeMap(TypeOf(simap))
|
||||
|
||||
refsimap.SetMapIndex(ValueOf(stringint{"hello", 4}), ValueOf(6))
|
||||
|
||||
six := refsimap.MapIndex(ValueOf(stringint{"hello", 4}))
|
||||
|
||||
if six.Interface().(int) != 6 {
|
||||
t.Errorf("m[hello, 4]=%v, want 6", six)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSlice(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user