diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-24 01:42:05 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-24 01:42:45 +0900 |
commit | afea8db8c7a6bca9042002dd305d45494eb2656f (patch) | |
tree | ddf1f3afa9059b12dee06a4d382c7e86db82f581 /test/date | |
parent | f295e23e54dd000806e252798e352f327606cd86 (diff) |
Test invalid offset warnings
Diffstat (limited to 'test/date')
-rw-r--r-- | test/date/test_date_strftime.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb index dc237a909d..f82874d26d 100644 --- a/test/date/test_date_strftime.rb +++ b/test/date/test_date_strftime.rb @@ -186,13 +186,16 @@ class TestDateStrftime < Test::Unit::TestCase (-24..24).collect{|x| '%+.2d' % x}.each do |hh| %w(00 30).each do |mm| r = hh + mm - if r[-4,4] == '2430' - r = '+0000' - end + next if r.end_with?('2430') d = DateTime.parse(s + hh + mm) assert_equal(r, d.strftime('%z')) end end + %w[+2430 -2430].each do |r| + assert_warning(/invalid offset/) do + DateTime.parse(s + r) + end + end end def test_strftime_milli |