summaryrefslogtreecommitdiff
path: root/test/psych/test_string.rb
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2014-08-16 16:49:52 +0200
committerJakub Jirutka <jakub@jirutka.cz>2014-08-16 17:42:57 +0200
commit010d0c37bde30c5f347ebfd69087a487ff8b8bbb (patch)
tree9331389c409fa806de6299273e569e97455abfe5 /test/psych/test_string.rb
parent0c4ee55072bf5b5bb64c66157f71ba6442f597db (diff)
downloadpsych-010d0c37bde30c5f347ebfd69087a487ff8b8bbb.zip
Don't quote scalar values beginning with non-ASCII character
Diffstat (limited to 'test/psych/test_string.rb')
-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 f1f061b..68917c8 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
@@ -19,6 +20,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)