summaryrefslogtreecommitdiff
path: root/test/psych
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-08 22:25:31 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-08 22:25:31 +0000
commit344b8bbd697ba7ade949da3968b9f5e6226f832f (patch)
tree99d8f602146fc84b20bc53933fb07605eaebe96c /test/psych
parent5dabead1871ed0100674e3eeb4a9f549b1997a85 (diff)
* ext/psych/lib/psych/visitors/yaml_tree.rb: correctly quote non-ascii
letters. Thanks @jirutka for the patch. * test/psych/test_string.rb: test for change git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r--test/psych/test_string.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index 1ce16fdf3ec..26a4e201e53 100644
--- a/test/psych/test_string.rb
+++ b/test/psych/test_string.rb
@@ -1,3 +1,4 @@
+# encoding: UTF-8
require_relative 'helper'
module Psych
@@ -23,6 +24,11 @@ module Psych
assert_equal 2, Psych.dump(%Q{<%= ENV["PATH"] %>}).count('"')
end
+ def test_no_quotes_when_start_with_non_ascii_character
+ yaml = Psych.dump 'Český non-ASCII'.encode(Encoding::UTF_8)
+ assert_match(/---\s*[^"'!]+$/, yaml)
+ end
+
def test_doublequotes_when_there_is_a_single
yaml = Psych.dump "@123'abc"
assert_match(/---\s*"/, yaml)