summaryrefslogtreecommitdiff
path: root/test/test_time.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-19 02:56:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-19 02:56:39 +0000
commitf75b676cc4f5411c4c1aa8cc9cb48d5dd665af6f (patch)
tree019d7adb954e3e2ae194070ab0046637280db877 /test/test_time.rb
parent595d057e60a9fe6550500dd17535e22134f0d63f (diff)
Fix `Time.parse` for out of range arguments with an offset
* lib/time.rb (Time#apply_offset): Guards against a `nil` return value from `Time.month_days` when offsetting date. Out of range values are then caught when `Time.utc` is called (as usual). Previously a `nil` return value from `Time.month_days` would have the `<` operator called on it, and raise `NoMethodError`. [fix GH-667] * lib/rdoc/parser/changelog.rb (RDoc#parse_entries): fix dirty hack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_time.rb')
-rw-r--r--test/test_time.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/test_time.rb b/test/test_time.rb
index c516d29..ecf07b2 100644
--- a/test/test_time.rb
+++ b/test/test_time.rb
@@ -307,6 +307,9 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
assert_raise(ArgumentError) { Time.rfc2822("=?iso-8859-1?Q?(=C5=DA),?= 10 2 2001 23:32:26 +0900 (JST)") }
assert_raise(ArgumentError) { Time.rfc2822("\307\341\314\343\332\311, 30 \344\346\335\343\310\321 2001 10:01:06") }
assert_raise(ArgumentError) { Time.rfc2822("=?iso-8859-1?Q?(=BF=E5),?= 12 =?iso-8859-1?Q?9=B7=EE?= 2001 14:52:41\n+0900 (JST)") }
+
+ # Out of range arguments
+ assert_raise(ArgumentError) { Time.parse("2014-13-13T18:00:00-0900") }
end
def test_zone_0000