From ec3056ae227fd79d706b2c6cdcdd8725df99c178 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Mon, 22 Oct 2012 21:09:56 +0000 Subject: * ext/psych/lib/psych/scalar_scanner.rb: Ignore bad timestamps. If something looks like a timestamp but has an invalid component, treat it as a string instead of throwing an ArgumentError. Thanks Rhett Sutphin! * test/psych/test_scalar_scanner.rb: appropriate tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/psych/test_scalar_scanner.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb index 1397020c88..8483eabc7d 100644 --- a/test/psych/test_scalar_scanner.rb +++ b/test/psych/test_scalar_scanner.rb @@ -21,6 +21,17 @@ module Psych end end + def test_scan_bad_time + [ '2001-12-15T02:59:73.1Z', + '2001-12-14t90:59:43.10-05:00', + '2001-92-14 21:59:43.10 -5', + '2001-12-15 92:59:43.10', + '2011-02-24 81:17:06 -0800', + ].each do |time_str| + assert_equal time_str, @ss.tokenize(time_str) + end + end + def test_scan_bad_dates x = '2000-15-01' assert_equal x, @ss.tokenize(x) -- cgit v1.2.3