committed by
Thomas Pelletier
parent
40cfb6f458
commit
7e2fa1bc80
@@ -397,6 +397,7 @@ func (p *parser) parseValArray(b []byte) (ast.Reference, []byte, error) {
|
|||||||
// array-values =/ ws-comment-newline val ws-comment-newline [ array-sep ]
|
// array-values =/ ws-comment-newline val ws-comment-newline [ array-sep ]
|
||||||
// array-sep = %x2C ; , Comma
|
// array-sep = %x2C ; , Comma
|
||||||
// ws-comment-newline = *( wschar / [ comment ] newline )
|
// ws-comment-newline = *( wschar / [ comment ] newline )
|
||||||
|
arrayStart := b
|
||||||
b = b[1:]
|
b = b[1:]
|
||||||
|
|
||||||
parent := p.builder.Push(ast.Node{
|
parent := p.builder.Push(ast.Node{
|
||||||
@@ -415,7 +416,7 @@ func (p *parser) parseValArray(b []byte) (ast.Reference, []byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(b) == 0 {
|
if len(b) == 0 {
|
||||||
return parent, nil, newDecodeError(b, "array is incomplete")
|
return parent, nil, newDecodeError(arrayStart[:1], "array is incomplete")
|
||||||
}
|
}
|
||||||
|
|
||||||
if b[0] == ']' {
|
if b[0] == ']' {
|
||||||
|
|||||||
@@ -1728,6 +1728,12 @@ func TestIssue579(t *testing.T) {
|
|||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue581(t *testing.T) {
|
||||||
|
var v interface{}
|
||||||
|
err := toml.Unmarshal([]byte(`P=[#`), &v)
|
||||||
|
require.Error(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
//nolint:funlen
|
//nolint:funlen
|
||||||
func TestUnmarshalDecodeErrors(t *testing.T) {
|
func TestUnmarshalDecodeErrors(t *testing.T) {
|
||||||
examples := []struct {
|
examples := []struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user