aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-05 02:47:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-05 02:47:53 +0000
commitc2a87a1fa138936dc8dca1b66fb719eec7f00b3a (patch)
treec04e4440c5484653c9879e164924d78ae4a2be34 /test/test_time.rb
parenta72f9f34767f9f2a6e8b7e22251949e65d2fe39d (diff)
downloadruby-c2a87a1fa138936dc8dca1b66fb719eec7f00b3a.tar.gz
* lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptime
doesn't extract date information. Reported by tadayoshi funaba. [ruby-core:62349] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_time.rb')
-rw-r--r--test/test_time.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_time.rb b/test/test_time.rb
index 54c2166ec5..b3dd40060c 100644
--- a/test/test_time.rb
+++ b/test/test_time.rb
@@ -423,6 +423,11 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
assert_equal(false, Time.strptime('0', '%s').utc?)
end
+ def test_strptime_empty
+ assert_raise(ArgumentError) { Time.strptime('', '') }
+ assert_raise(ArgumentError) { Time.strptime('+09:00', '%z') }
+ end
+
def test_strptime_s_z
t = Time.strptime('0 +0100', '%s %z')
assert_equal(0, t.to_r)