mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Test invalid offset warnings
This commit is contained in:
parent
f295e23e54
commit
afea8db8c7
1 changed files with 6 additions and 3 deletions
|
@ -186,13 +186,16 @@ class TestDateStrftime < Test::Unit::TestCase
|
||||||
(-24..24).collect{|x| '%+.2d' % x}.each do |hh|
|
(-24..24).collect{|x| '%+.2d' % x}.each do |hh|
|
||||||
%w(00 30).each do |mm|
|
%w(00 30).each do |mm|
|
||||||
r = hh + mm
|
r = hh + mm
|
||||||
if r[-4,4] == '2430'
|
next if r.end_with?('2430')
|
||||||
r = '+0000'
|
|
||||||
end
|
|
||||||
d = DateTime.parse(s + hh + mm)
|
d = DateTime.parse(s + hh + mm)
|
||||||
assert_equal(r, d.strftime('%z'))
|
assert_equal(r, d.strftime('%z'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
%w[+2430 -2430].each do |r|
|
||||||
|
assert_warning(/invalid offset/) do
|
||||||
|
DateTime.parse(s + r)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_strftime_milli
|
def test_strftime_milli
|
||||||
|
|
Loading…
Reference in a new issue