@@ -400,6 +400,10 @@ func checkAndRemoveUnderscoresIntegers(b []byte) ([]byte, error) {
|
|||||||
start++
|
start++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(b) == start {
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
if b[start] == '_' {
|
if b[start] == '_' {
|
||||||
return nil, newDecodeError(b[start:start+1], "number cannot start with underscore")
|
return nil, newDecodeError(b[start:start+1], "number cannot start with underscore")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2326,6 +2326,18 @@ func TestIssue710(t *testing.T) {
|
|||||||
require.Equal(t, map[string]toml.LocalTime{"0": {Nanosecond: 111111111, Precision: 9}}, v2)
|
require.Equal(t, map[string]toml.LocalTime{"0": {Nanosecond: 111111111, Precision: 9}}, v2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue715(t *testing.T) {
|
||||||
|
var v interface{}
|
||||||
|
err := toml.Unmarshal([]byte("0=+"), &v)
|
||||||
|
require.Error(t, err)
|
||||||
|
|
||||||
|
err = toml.Unmarshal([]byte("0=-"), &v)
|
||||||
|
require.Error(t, err)
|
||||||
|
|
||||||
|
err = toml.Unmarshal([]byte("0=+A"), &v)
|
||||||
|
require.Error(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
func TestUnmarshalDecodeErrors(t *testing.T) {
|
func TestUnmarshalDecodeErrors(t *testing.T) {
|
||||||
examples := []struct {
|
examples := []struct {
|
||||||
desc string
|
desc string
|
||||||
|
|||||||
Reference in New Issue
Block a user