* ext/psych/lib/psych/scalar_scanner.rb: fix regexp for matching TIME

strings.
* test/psych/test_date_time.rb: test for change.
  Fixes: https://github.com/tenderlove/psych/issues/171

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2013-11-26 19:48:03 +00:00
Родитель 4760b9824f
Коммит 725d6f4970
3 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Wed Nov 27 04:46:55 2013 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/scalar_scanner.rb: fix regexp for matching TIME
strings.
* test/psych/test_date_time.rb: test for change.
Fixes: https://github.com/tenderlove/psych/issues/171
Wed Nov 27 02:26:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (str_new4): copy the original capacity so that memsize of

Просмотреть файл

@ -5,7 +5,7 @@ module Psych
# Scan scalars for built in types
class ScalarScanner
# Taken from http://yaml.org/type/timestamp.html
TIME = /^\d{4}-\d{1,2}-\d{1,2}([Tt]|\s+)\d{1,2}:\d\d:\d\d(\.\d*)?(\s*Z|[-+]\d{1,2}(:\d\d)?)?/
TIME = /^\d{4}-\d{1,2}-\d{1,2}(?:[Tt]|\s+)\d{1,2}:\d\d:\d\d(?:\.\d*)?(?:\s*(?:Z|[-+]\d{1,2}:?(?:\d\d)?))?$/
# Taken from http://yaml.org/type/float.html
FLOAT = /^(?:[-+]?([0-9][0-9_,]*)?\.[0-9]*([eE][-+][0-9]+)?(?# base 10)

Просмотреть файл

@ -3,6 +3,10 @@ require 'date'
module Psych
class TestDateTime < TestCase
def test_invalid_date
assert_cycle "2013-10-31T10:40:07-000000000000033"
end
def test_string_tag
dt = DateTime.now
yaml = Psych.dump dt