Fix unmarshal error with tab in multi-line basic string (#355)

Fixes #354
This commit is contained in:
Allen
2020-04-15 20:46:56 +08:00
committed by GitHub
parent 145b18309a
commit e872682c78
3 changed files with 37 additions and 4 deletions
+23
View File
@@ -1419,6 +1419,29 @@ func TestMarshalDirectMultilineString(t *testing.T) {
}
}
//issue 354
func TestUnmarshalMultilineStringWithTab(t *testing.T) {
input := []byte(`
Field = """
hello world"""
`)
type Test struct {
Field string
}
expected := Test{"hello\tworld"}
result := Test{}
err := Unmarshal(input, &result)
if err != nil {
t.Fatal("unmarshal should not error:", err)
}
if !reflect.DeepEqual(result, expected) {
t.Errorf("Bad unmarshal: expected\n-----\n%+v\n-----\ngot\n-----\n%+v\n-----\n", expected, result)
}
}
var customMultilineTagTestToml = []byte(`int_slice = [
1,
2,