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