summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorColin Kelley <colin@invoca.com>2023-07-19 12:32:12 -0700
committergit <svn-admin@ruby-lang.org>2024-01-17 00:45:06 +0000
commit8ae24e6b085121c6d3de61b45cf089849fe4a177 (patch)
treecac3e3dde165a4b466f8c61dd3755aa6440b58ba /test
parentcf8fb9429511068c69ce70da7f7818c7441c280b (diff)
[ruby/psych] issue #443: quote Y and N when dumping
https://github.com/ruby/psych/commit/93c8fb443a
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_string.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index 0dc34b3083..c996a8fc2d 100644
--- a/test/psych/test_string.rb
+++ b/test/psych/test_string.rb
@@ -24,10 +24,19 @@ module Psych
# "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}"|'#{boolean}'/, Psych.dump(boolean))
+ end
end
def test_string_with_newline