aboutsummaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings')
-rw-r--r--src/strings/builder_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/strings/builder_test.go b/src/strings/builder_test.go
index e3d239266f..dbc2c1943b 100644
--- a/src/strings/builder_test.go
+++ b/src/strings/builder_test.go
@@ -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) {