scanner: fix error reporting for last comments (#591)
When an invalid TOML expression ends with a comment before the end of file, the decode error would take a nil from scanComment, which is not part of the document. Fixes #588
This commit is contained in:
@@ -1740,6 +1740,12 @@ func TestIssue586(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestIssue588(t *testing.T) {
|
||||
var v interface{}
|
||||
err := toml.Unmarshal([]byte(`a=[1#`), &v)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
//nolint:funlen
|
||||
func TestUnmarshalDecodeErrors(t *testing.T) {
|
||||
examples := []struct {
|
||||
|
||||
Reference in New Issue
Block a user