mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 14:33:41 +00:00
reflect: add MakeSlice()
This commit is contained in:
@@ -132,6 +132,13 @@ func TestSlice(t *testing.T) {
|
||||
t.Errorf("s[%d]=%d, want %d", i, s[i], i*10)
|
||||
}
|
||||
}
|
||||
|
||||
refs = MakeSlice(TypeOf(s), 5, 10)
|
||||
s = refs.Interface().([]int)
|
||||
|
||||
if len(s) != refs.Len() || cap(s) != refs.Cap() {
|
||||
t.Errorf("len(s)=%v refs.Len()=%v cap(s)=%v refs.Cap()=%v", len(s), refs.Len(), cap(s), refs.Cap())
|
||||
}
|
||||
}
|
||||
|
||||
func equal[T comparable](a, b []T) bool {
|
||||
|
||||
Reference in New Issue
Block a user