Skip to content

Commit

Permalink
issue #443: drop special tests for y, Y, n, N since they covered in t…
Browse files Browse the repository at this point in the history
…he more general test
  • Loading branch information
ColinDKelley committed Jul 19, 2023
1 parent 93c8fb4 commit 6750b35
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions test/psych/test_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,11 @@ def initialize
end
end

# 'y' and 'n' are kind of ambiguous. Syck treated y and n literals in
# 'y', 'Y', 'n', 'N' are kind of ambiguous. Syck treated those literals in
# YAML documents as strings. But this is not what the YAML 1.1 spec says.
# YAML 1.1 says they should be treated as booleans. When we're dumping
# documents, we know it's a string, so adding quotes will eliminate the
# "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
Expand Down

0 comments on commit 6750b35

Please sign in to comment.