Skip to content

Commit

Permalink
Quote is required even if it begins with backquote. (goccy#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW authored and charithe committed Jul 22, 2024
1 parent 05e46a8 commit bf7ca53
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 bf7ca53

Please sign in to comment.