Skip to content

Commit

Permalink
issue ruby#443: quote Y and N when dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinDKelley committed Jul 19, 2023
1 parent 9de928f commit 7ddfd0f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/psych/test_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ def initialize
# "ambiguity" in the emitted document
def test_y_is_quoted
assert_match(/"y"/, Psych.dump("y"))
assert_match(/"Y"/, Psych.dump("Y"))
end

def test_n_is_quoted
assert_match(/"n"/, Psych.dump("n"))
assert_match(/"N"/, Psych.dump("N"))
end

def test_all_yaml_1_1_booleans_are_quoted
yaml_1_1_booleans = %w[y Y yes Yes YES n N no No NO true True TRUE false False FALSE on On ON off Off OFF] # from https://yaml.org/type/bool.html
yaml_1_1_booleans.each do |boolean|
assert_match(/"#{boolean}"/, Psych.dump(boolean))
end
end

def test_string_with_newline
Expand Down

0 comments on commit 7ddfd0f

Please sign in to comment.