From 8a4cc4e02a2dc161008f9df99dfe6fb9698de649 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Thu, 13 Dec 2012 22:45:16 +0000 Subject: * ext/psych/lib/psych/visitors/yaml_tree.rb: quote strings that begin with non-word characters. Thanks Alex Tambellini! * test/psych/test_yaml.rb: appropriate test case git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/psych/test_yaml.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb index cbda3859e6..5e1ebb4b4b 100644 --- a/test/psych/test_yaml.rb +++ b/test/psych/test_yaml.rb @@ -1271,4 +1271,10 @@ EOY yaml = Psych.dump("multi\nline\nstring") assert_match("|", yaml) end + + def test_string_starting_with_non_word_character_uses_double_quotes_without_exclamation_mark + yaml = Psych.dump("@123'abc") + assert_match("\"", yaml) + refute_match("!", yaml) + end end -- cgit v1.2.3