Multiline strings fixes (#643)

* scanner: allow multiline strings to end with "" or ''

* parser: trim all whitespaces after \ in multiline
This commit is contained in:
Thomas Pelletier
2021-10-28 18:26:34 -04:00
committed by GitHub
parent c871a61015
commit 39f893ad99
4 changed files with 66 additions and 8 deletions
+4
View File
@@ -7,6 +7,7 @@ import (
"encoding/json"
"testing"
"github.com/pelletier/go-toml/v2"
"github.com/pelletier/go-toml/v2/testsuite"
"github.com/stretchr/testify/require"
)
@@ -37,6 +38,9 @@ func testgenValid(t *testing.T, input string, jsonRef string) {
err := testsuite.Unmarshal([]byte(input), &doc)
if err != nil {
if de, ok := err.(*toml.DecodeError); ok {
t.Logf("%s\n%s", err, de)
}
t.Fatalf("failed parsing toml: %s", err)
}
j, err := testsuite.ValueToTaggedJSON(doc)