aboutsummaryrefslogtreecommitdiff
path: root/src/math/big/floatconv_test.go
diff options
context:
space:
mode:
authorAlberto Donizetti <alb.donizetti@gmail.com>2016-06-01 19:16:56 +0200
committerRobert Griesemer <gri@golang.org>2016-06-01 19:20:52 +0000
commit5db44c17a2391bbdfbc3c04e83e66025ca5dea3d (patch)
tree12c62de50e8b3352ae142c734d62f16e7190277d /src/math/big/floatconv_test.go
parent77026ef902d3fa21597400d230701979bc1f0efc (diff)
downloadgo-5db44c17a2391bbdfbc3c04e83e66025ca5dea3d.tar.xz
math/big: avoid panic in float.Text with negative prec
Fixes #15918 Change-Id: I4b434aed262960a2e6c659d4c2296fbf662c3a52 Reviewed-on: https://go-review.googlesource.com/23633 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/math/big/floatconv_test.go')
-rw-r--r--src/math/big/floatconv_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/math/big/floatconv_test.go b/src/math/big/floatconv_test.go
index b6f9993608..b2a1ab05fc 100644
--- a/src/math/big/floatconv_test.go
+++ b/src/math/big/floatconv_test.go
@@ -290,6 +290,11 @@ func TestFloat64Text(t *testing.T) {
// Issue 2625.
{383260575764816448, 'f', 0, "383260575764816448"},
{383260575764816448, 'g', -1, "3.8326057576481645e+17"},
+
+ // Issue 15918.
+ {1, 'f', -10, "1"},
+ {1, 'f', -11, "1"},
+ {1, 'f', -12, "1"},
} {
// The test cases are from the strconv package which tests float64 values.
// When formatting values with prec = -1 (shortest representation),