1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/psych/lib/psych/scalar_scanner.rb: fix loading strings that

look like integers but have a newline. Fixes GH #189
* test/psych/test_string.rb: test for fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2014-08-29 21:24:33 +00:00
parent 73645bb8e5
commit 8662841a9b
3 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Sat Aug 30 06:23:40 2014 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/scalar_scanner.rb: fix loading strings that
look like integers but have a newline. Fixes GH #189
* test/psych/test_string.rb: test for fix
Sat Aug 30 06:10:39 2014 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/to_ruby.rb: merge keys with a hash

View file

@ -37,7 +37,7 @@ module Psych
case string
# Check for a String type, being careful not to get caught by hash keys, hex values, and
# special floats (e.g., -.inf).
when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/
when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/, /\n/
if string.length > 5
@string_cache[string] = true
return string

View file

@ -15,6 +15,10 @@ module Psych
end
end
def test_string_with_newline
assert_equal "1\n2", Psych.load("--- ! '1\n\n 2'\n")
end
def test_no_doublequotes_with_special_characters
assert_equal 2, Psych.dump(%Q{<%= ENV["PATH"] %>}).count('"')
end