Skip to content

Commit

Permalink
Add ? to the list of things to quote when it's an exact value.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlwilkerson authored and mruoss committed Dec 27, 2023
1 parent 2bc75da commit 2e06eb4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/ymlr/encode.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ defmodule Ymlr.Encode do
@single_quote_when_exact [
"",
"~",
"?",
"null",
"yes",
"no",
Expand Down
1 change: 1 addition & 0 deletions test/ymlr/encode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ defmodule Ymlr.EncodeTest do
end

test "quoted strings - starts with special char" do
assert_identity_and_output("?", ~S('?'))
assert_identity_and_output("!tag", ~S('!tag'))
assert_identity_and_output("&anchor", ~S('&anchor'))
assert_identity_and_output("*alias", ~S('*alias'))
Expand Down

0 comments on commit 2e06eb4

Please sign in to comment.