encoder: support multiline strings + local options

This commit is contained in:
Thomas Pelletier
2021-04-10 17:58:37 -04:00
parent ed1f9ed9de
commit 9e122af5fc
3 changed files with 78 additions and 23 deletions
+18
View File
@@ -216,6 +216,24 @@ name = 'Alice'
},
expected: `a = "'\u001A"`,
},
{
desc: "multi-line string",
v: map[string]interface{}{
"a": "hello\nworld",
},
expected: `a = "hello\nworld"`,
},
{
desc: "multi-line forced",
v: struct {
A string `multiline:"true"`
}{
A: "hello\nworld",
},
expected: `A = """
hello
world"""`,
},
}
for _, e := range examples {