Unverified Commit 6e5cf904 authored by Bryan Liles's avatar Bryan Liles Committed by GitHub
Browse files

Merge pull request #495 from bryanl/value-leading-zero

decode string with leading 0 as string
parents dcebde9c 833a76df
...@@ -248,8 +248,8 @@ func arrayValues(array *ast.Array) ([]interface{}, error) { ...@@ -248,8 +248,8 @@ func arrayValues(array *ast.Array) ([]interface{}, error) {
} }
var ( var (
reFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+$`) reFloat = regexp.MustCompile(`^[-+]?(0|[1-9]\d+)(\.[0-9]+)*$`)
reInt = regexp.MustCompile(`^([+-]?[1-9]\d*|0)$`) reInt = regexp.MustCompile(`^([+-]?[1-9]\d*|0{1})$`)
reArray = regexp.MustCompile(`^\[`) reArray = regexp.MustCompile(`^\[`)
reMap = regexp.MustCompile(`^\{`) reMap = regexp.MustCompile(`^\{`)
) )
......
...@@ -241,6 +241,11 @@ func TestDecodeValue(t *testing.T) { ...@@ -241,6 +241,11 @@ func TestDecodeValue(t *testing.T) {
val: "0", val: "0",
expected: 0, expected: 0,
}, },
{
name: "00",
val: "00",
expected: "00",
},
{ {
name: "bool true", name: "bool true",
val: "True", val: "True",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment