aboutsummaryrefslogtreecommitdiff
path: root/src/internal/fuzz/encoding_test.go
diff options
context:
space:
mode:
authorKatie Hockman <katie@golang.org>2021-04-09 15:50:40 -0400
committerKatie Hockman <katie@golang.org>2021-04-12 18:51:16 +0000
commit8b96efd8a274a65504dc9051e0545379d26f8445 (patch)
tree38a1db70d8c14756400a5fff7fdb9f69e0924b28 /src/internal/fuzz/encoding_test.go
parent88c0c2d9ea9c57eb3c5915d9e90ec59ae5a35a35 (diff)
downloadgo-8b96efd8a274a65504dc9051e0545379d26f8445.tar.xz
[dev.fuzz] internal/fuzz: allow float types to be integer literals
Previously, something like `float64(0)` would fail to decode since the 0 value is considered an integer literal, and the float64 parsing code required a float literal. Be more flexible here since an integer can always be converted to a float. Change-Id: Id1c53ef2e8a9748a4f71176b00b453a329af4ade Reviewed-on: https://go-review.googlesource.com/c/go/+/309032 Trust: Katie Hockman <katie@golang.org> Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/internal/fuzz/encoding_test.go')
-rw-r--r--src/internal/fuzz/encoding_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/internal/fuzz/encoding_test.go b/src/internal/fuzz/encoding_test.go
index cbf4999f8d..3cd8d0e2ab 100644
--- a/src/internal/fuzz/encoding_test.go
+++ b/src/internal/fuzz/encoding_test.go
@@ -72,6 +72,13 @@ string("extra")
},
{
in: `go test fuzz v1
+float64(0)
+float32(0)
+`,
+ ok: true, // will be an integer literal since there is no decimal
+ },
+ {
+ in: `go test fuzz v1
int(-23)
int8(-2)
int64(2342425)