mirror of
https://github.com/golang/go
synced 2024-09-28 20:14:28 -06:00
add two Delete panic test cases
This commit is contained in:
parent
59d7433ecf
commit
600069cd14
@ -672,8 +672,10 @@ func TestDeletePanics(t *testing.T) {
|
||||
{"with negative second index", []int{42}, 1, -1},
|
||||
{"with out-of-bounds first index", []int{42}, 2, 3},
|
||||
{"with out-of-bounds second index", []int{42}, 0, 2},
|
||||
{"with out-of-bounds both indexes", []int{42}, 2, 2},
|
||||
{"with invalid i>j", []int{42}, 1, 0},
|
||||
{"s[i:j] is valid and j > len(s)", s, 0, 4},
|
||||
{"s[i:j] is valid and i == j > len(s)", s, 4, 4},
|
||||
} {
|
||||
if !panics(func() { Delete(test.s, test.i, test.j) }) {
|
||||
t.Errorf("Delete %s: got no panic, want panic", test.name)
|
||||
|
Loading…
Reference in New Issue
Block a user