mirror of
https://github.com/golang/go
synced 2024-11-18 06:54:49 -07:00
strings: add a test case of growLen is negative
Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
parent
54182ff54a
commit
2a55ca3e33
@ -109,6 +109,15 @@ func TestBuilderGrow(t *testing.T) {
|
||||
t.Errorf("growLen=%d: got %d allocs during Write; want %v", growLen, g, w)
|
||||
}
|
||||
}
|
||||
// when growLen < 0, should panic
|
||||
var a Builder
|
||||
n := -1
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
t.Errorf("a.Grow(%d) should panic()", n)
|
||||
}
|
||||
}()
|
||||
a.Grow(n)
|
||||
}
|
||||
|
||||
func TestBuilderWrite2(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user