func TestInsertPanics(t *testing.T) {
a := [3]int{}
+ b := [1]int{}
for _, test := range []struct {
name string
s []int
{"with out-of-bounds index and > cap", a[:1:1], 2, nil},
{"with out-of-bounds index and = cap", a[:1:2], 2, nil},
{"with out-of-bounds index and < cap", a[:1:3], 2, nil},
+
+ // There are values.
+ {"with negative index", a[:1:1], -1, b[:]},
+ {"with out-of-bounds index and > cap", a[:1:1], 2, b[:]},
+ {"with out-of-bounds index and = cap", a[:1:2], 2, b[:]},
+ {"with out-of-bounds index and < cap", a[:1:3], 2, b[:]},
} {
if !panics(func() { Insert(test.s, test.i, test.v...) }) {
t.Errorf("Insert %s: got no panic, want panic", test.name)