1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/date: removed unnecessaruy __send__

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-12-11 05:09:35 +00:00
parent 1a0e374b33
commit 8c69f7ec44
2 changed files with 22 additions and 22 deletions

View file

@ -88,16 +88,16 @@ class TestDateAttr < Test::Unit::TestCase
end
def test_nth_kday
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, 1,0))
assert_equal(true, Date.new(2001,1,14).__send__(:nth_kday?, 2,0))
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, 3,0))
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, 4,0))
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, 5,0))
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, -1,0))
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, -2,0))
assert_equal(true, Date.new(2001,1,14).__send__(:nth_kday?, -3,0))
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, -4,0))
assert_equal(false, Date.new(2001,1,14).__send__(:nth_kday?, -5,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(1,0))
assert_equal(true, Date.new(2001,1,14).nth_kday?(2,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(3,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(4,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(5,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(-1,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(-2,0))
assert_equal(true, Date.new(2001,1,14).nth_kday?(-3,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(-4,0))
assert_equal(false, Date.new(2001,1,14).nth_kday?(-5,0))
end if Date.new.respond_to?(:nth_kday?, true)
end

View file

@ -203,46 +203,46 @@ class TestDateNew < Test::Unit::TestCase
end
def test_weeknum
d = Date.__send__(:weeknum)
dt = DateTime.__send__(:weeknum)
d = Date.weeknum
dt = DateTime.weeknum
assert_equal([-4712, 1, 1], [d.year, d.mon, d.mday])
assert_equal([-4712, 1, 1], [dt.year, dt.mon, dt.mday])
assert_equal([0, 0, 0], [dt.hour, dt.min, dt.sec])
d = Date.__send__(:weeknum, 2002,11,4, 0)
d = Date.weeknum(2002,11,4, 0)
assert_equal(2452355, d.jd)
d = DateTime.__send__(:weeknum, 2002,11,4, 0, 11,22,33)
d = DateTime.weeknum(2002,11,4, 0, 11,22,33)
assert_equal(2452355, d.jd)
assert_equal([11,22,33], [d.hour, d.min, d.sec])
assert_raise(ArgumentError) do
Date.__send__(:weeknum, 1999,53,0, 0)
Date.weeknum(1999,53,0, 0)
end
assert_raise(ArgumentError) do
Date.__send__(:weeknum, 1999,-53,-1, 0)
Date.weeknum(1999,-53,-1, 0)
end
end if Date.respond_to?(:weeknum, true)
def test_nth_kday
d = Date.__send__(:nth_kday)
dt = DateTime.__send__(:nth_kday)
d = Date.nth_kday
dt = DateTime.nth_kday
assert_equal([-4712, 1, 1], [d.year, d.mon, d.mday])
assert_equal([-4712, 1, 1], [dt.year, dt.mon, dt.mday])
assert_equal([0, 0, 0], [dt.hour, dt.min, dt.sec])
d = Date.__send__(:nth_kday, 1992,2, 5,6)
d = Date.nth_kday(1992,2, 5,6)
assert_equal(2448682, d.jd)
d = DateTime.__send__(:nth_kday, 1992,2, 5,6, 11,22,33)
d = DateTime.nth_kday(1992,2, 5,6, 11,22,33)
assert_equal(2448682, d.jd)
assert_equal([11,22,33], [d.hour, d.min, d.sec])
assert_raise(ArgumentError) do
Date.__send__(:nth_kday, 2006,5, 5,0)
Date.nth_kday(2006,5, 5,0)
end
assert_raise(ArgumentError) do
Date.__send__(:nth_kday, 2006,5, -5,0)
Date.nth_kday(2006,5, -5,0)
end
end if Date.respond_to?(:nth_kday, true)