diff options
author | Rhett Sutphin <rhett@detailedbalance.net> | 2012-09-11 16:01:43 -0500 |
---|---|---|
committer | Rhett Sutphin <rhett@detailedbalance.net> | 2012-09-11 16:01:43 -0500 |
commit | 0c478a1ec7f8649ad416b181f8ef4c8a05860f17 (patch) | |
tree | 1f3de2c2f9d013d2d8304299abd0168666fb7505 /test/psych/test_scalar_scanner.rb | |
parent | 06c8c7f7de84cb5a29df01d05149f92f99ea967b (diff) | |
download | psych-0c478a1ec7f8649ad416b181f8ef4c8a05860f17.zip |
Ignore bad timestamps. #82.
If something looks like a timestamp but has an invalid component,
treat it as a string instead of throwing an ArgumentError.
Diffstat (limited to 'test/psych/test_scalar_scanner.rb')
-rw-r--r-- | test/psych/test_scalar_scanner.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb index 1397020..8483eab 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) |