Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve: add missing character in float regex #428

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,13 @@ var unmarshalTests = []struct {
M{"ñoño": "very yes 🟔"},
},

// YAML Float regex shouldn't match this
// YAML Float regex
{
"a: 123456e1\n",
M{"a": "123456e1"},
M{"a": float64(1234560)},
}, {
"a: 123456E1\n",
M{"a": "123456E1"},
M{"a": float64(1234560)},
},
// yaml-test-suite 3GZX: Spec Example 7.1. Alias Nodes
{
Expand Down
3 changes: 3 additions & 0 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ var marshalTests = []struct {
}, {
map[string]interface{}{"v": "10"},
"v: \"10\"\n",
}, {
map[string]interface{}{"v": "123e1"},
"v: \"123e1\"\n",
}, {
map[string]interface{}{"v": 0.1},
"v: 0.1\n",
Expand Down
2 changes: 1 addition & 1 deletion resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func resolvableTag(tag string) bool {
return false
}

var yamlStyleFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+([eE][-+][0-9]+)?$`)
var yamlStyleFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$`)

func resolve(tag string, in string) (rtag string, out interface{}) {
if !resolvableTag(tag) {
Expand Down