Quote YAML 1.1 bools at encoding time for compatibility with other legacy parsers (#354)

This commit is contained in:
Yusuke Kuoka 2023-03-14 15:24:34 +09:00 committed by GitHub
parent 11ad39b5c5
commit f3319d6c80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 6 deletions

View file

@ -440,7 +440,7 @@ func TestEncoder(t *testing.T) {
},
{
"a:\n y: \"\"\n",
"a:\n \"y\": \"\"\n",
struct {
A *struct {
X string `yaml:"x,omitempty"`
@ -702,7 +702,7 @@ func TestEncodeStructIncludeMap(t *testing.T) {
if err != nil {
t.Fatalf("%+v", err)
}
expect := "a:\n m:\n x: y\n"
expect := "a:\n m:\n x: \"y\"\n"
actual := string(bytes)
if actual != expect {
t.Fatalf("unexpected output. expect:[%s] actual:[%s]", expect, actual)
@ -720,7 +720,7 @@ func TestEncodeDefinedTypeKeyMap(t *testing.T) {
if err != nil {
t.Fatalf("%+v", err)
}
expect := "m:\n x: y\n"
expect := "m:\n x: \"y\"\n"
actual := string(bytes)
if actual != expect {
t.Fatalf("unexpected output. expect:[%s] actual:[%s]", expect, actual)