diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-28 17:42:38 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-28 17:42:38 +0000 |
commit | 48602d1dbfe6e17f47704839f1721ee254150694 (patch) | |
tree | df63f6eeeee04932591cace7a7d2d2a330dff4b3 | |
parent | 806ddf671313be82a977d4afba9ff668d95bbb14 (diff) | |
download | ruby-48602d1dbfe6e17f47704839f1721ee254150694.tar.gz |
* ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be
treated as strings.
[Fixes GH-156] https://github.com/tenderlove/psych/issues/156
* test/psych/test_string.rb: test for change
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ext/psych/lib/psych/scalar_scanner.rb | 2 | ||||
-rw-r--r-- | test/psych/test_string.rb | 5 |
3 files changed, 14 insertions, 1 deletions
@@ -1,3 +1,11 @@ +Thu Aug 29 02:40:45 2013 Aaron Patterson <aaron@tenderlovemaking.com> + + * ext/psych/lib/psych/scalar_scanner.rb: invalid floats should be + treated as strings. + [Fixes GH-156] https://github.com/tenderlove/psych/issues/156 + + * test/psych/test_string.rb: test for change + Wed Aug 28 17:20:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> * thread_pthread.c (hpux_attr_getstackaddr): basic support for the diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb index 7a9bb87cbd..068fc0e3cf 100644 --- a/ext/psych/lib/psych/scalar_scanner.rb +++ b/ext/psych/lib/psych/scalar_scanner.rb @@ -95,7 +95,7 @@ module Psych end i when FLOAT - if string == '.' + if string =~ /\A[-+]?\.\Z/ @string_cache[string] = true string else diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb index 0bdba184f3..2512bb6802 100644 --- a/test/psych/test_string.rb +++ b/test/psych/test_string.rb @@ -15,6 +15,11 @@ module Psych end end + def test_dash_dot + assert_cycle '-.' + assert_cycle '+.' + end + def test_string_subclass_with_anchor y = Psych.load <<-eoyml --- |