Skip to content

Commit

Permalink
Quote is required even if it begins with backquote. (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW authored Jul 16, 2024
1 parent b5f63d5 commit 237df0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ func TestEncoder(t *testing.T) {
map[string]string{"a": " b "},
nil,
},
{
"a: \"`b` c\"\n",
map[string]string{"a": "`b` c"},
nil,
},
{
"a: 100.5\n",
map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ func IsNeedQuoted(value string) bool {
}
first := value[0]
switch first {
case '*', '&', '[', '{', '}', ']', ',', '!', '|', '>', '%', '\'', '"', '@', ' ':
case '*', '&', '[', '{', '}', ']', ',', '!', '|', '>', '%', '\'', '"', '@', ' ', '`':
return true
}
last := value[len(value)-1]
Expand Down

0 comments on commit 237df0e

Please sign in to comment.