Floats and integers parsing fixes (#638)

* parser: fix scan of float with exp but no decimal
* decoder: validate leading zeros for decimals
This commit is contained in:
Thomas Pelletier
2021-10-22 22:25:56 -04:00
committed by GitHub
parent feb1830dcc
commit 4d7c9ddac7
4 changed files with 20 additions and 4 deletions
+5
View File
@@ -149,6 +149,11 @@ func TestUnmarshal_Floats(t *testing.T) {
input: `-2E-2`,
expected: -2e-2,
},
{
desc: "float exponent zero",
input: `0e0`,
expected: 0.0,
},
{
desc: "float fractional with exponent",
input: `6.626e-34`,