ruby-changes:56633
From: Nobuyoshi <ko1@a...>
Date: Wed, 24 Jul 2019 01:46:02 +0900 (JST)
Subject: [ruby-changes:56633] Nobuyoshi Nakada: afea8db8c7 (master): Test invalid offset warnings
https://git.ruby-lang.org/ruby.git/commit/?id=afea8db8c7 From afea8db8c7a6bca9042002dd305d45494eb2656f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 24 Jul 2019 01:42:05 +0900 Subject: Test invalid offset warnings diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb index dc237a9..f82874d 100644 --- a/test/date/test_date_strftime.rb +++ b/test/date/test_date_strftime.rb @@ -186,13 +186,16 @@ class TestDateStrftime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/date/test_date_strftime.rb#L186 (-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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/