mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* reverted 34739 for test/date.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9fc31792ce
commit
8cd604c6c7
5 changed files with 21 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Feb 22 19:22:31 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* reverted 34739 for test/date.
|
||||
|
||||
Wed Feb 22 19:08:55 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/curses/extconf.rb: refactored.
|
||||
|
|
|
@ -96,6 +96,7 @@ class TestDateAttr < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_nth_kday
|
||||
skip unless Date.new.respond_to?(:nth_kday?, true)
|
||||
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))
|
||||
|
@ -106,6 +107,6 @@ class TestDateAttr < Test::Unit::TestCase
|
|||
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))
|
||||
end if Date.new.respond_to?(:nth_kday?, true)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -53,6 +53,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ordinal__julian
|
||||
skip unless defined?(Calendar)
|
||||
for j in @from..@to
|
||||
m, d, y = julian_from_absolute(absolute_from_julian_day_number(j))
|
||||
j0 = julian_day_number_from_absolute(absolute_from_julian(12, 31, y - 1))
|
||||
|
@ -67,6 +68,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_ordinal__gregorian
|
||||
skip unless defined?(Calendar)
|
||||
for j in @from..@to
|
||||
m, d, y = gregorian_from_absolute(absolute_from_julian_day_number(j))
|
||||
j0 =
|
||||
|
@ -82,6 +84,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_civil__julian
|
||||
skip unless defined?(Calendar)
|
||||
for j in @from..@to
|
||||
m, d, y = julian_from_absolute(absolute_from_julian_day_number(j))
|
||||
j2 = julian_day_number_from_absolute(absolute_from_julian(m, d, y))
|
||||
|
@ -96,6 +99,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_civil__gregorian
|
||||
skip unless defined?(Calendar)
|
||||
for j in @from..@to
|
||||
m, d, y = gregorian_from_absolute(absolute_from_julian_day_number(j))
|
||||
j2 = julian_day_number_from_absolute(absolute_from_gregorian(m, d, y))
|
||||
|
@ -110,6 +114,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_commercial__gregorian
|
||||
skip unless defined?(Calendar)
|
||||
for j in @from..@to
|
||||
w, d, y = iso_from_absolute(absolute_from_julian_day_number(j))
|
||||
j2 = julian_day_number_from_absolute(absolute_from_iso(w, d, y))
|
||||
|
@ -124,6 +129,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_weeknum
|
||||
skip unless defined?(Calendar)
|
||||
for j in @from..@to
|
||||
for k in 0..1
|
||||
wy, ww, wd = Date.__send__(:jd_to_weeknum, j, k, Date::GREGORIAN)
|
||||
|
@ -134,6 +140,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_weeknum__2
|
||||
skip unless defined?(Calendar)
|
||||
for j in @from4t..@to4t
|
||||
d = Date.jd(j)
|
||||
t = Time.mktime(d.year, d.mon, d.mday)
|
||||
|
@ -151,6 +158,7 @@ class TestDateBase < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_nth_kday
|
||||
skip unless defined?(Calendar)
|
||||
skip unless (Date.respond_to?(:nth_kday_to_jd, true) &&
|
||||
Date.respond_to?(:jd_to_nth_kday, true))
|
||||
for y in 1601..2401
|
||||
|
@ -431,4 +439,4 @@ class TestDateBase < Test::Unit::TestCase
|
|||
assert_nil(DateTime.__send__(valid_time_p, 24,1,1))
|
||||
end
|
||||
|
||||
end if defined?(Calendar)
|
||||
end
|
||||
|
|
|
@ -202,6 +202,7 @@ class TestDateNew < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_weeknum
|
||||
skip unless Date.respond_to?(:weeknum, true)
|
||||
d = Date.__send__(:weeknum)
|
||||
dt = DateTime.__send__(:weeknum)
|
||||
assert_equal([-4712, 1, 1], [d.year, d.mon, d.mday])
|
||||
|
@ -221,9 +222,10 @@ class TestDateNew < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError) do
|
||||
Date.__send__(:weeknum, 1999,-53,-1, 0)
|
||||
end
|
||||
end if Date.respond_to?(:weeknum, true)
|
||||
end
|
||||
|
||||
def test_nth_kday
|
||||
skip unless Date.respond_to?(:nth_kday, true)
|
||||
d = Date.__send__(:nth_kday)
|
||||
dt = DateTime.__send__(:nth_kday)
|
||||
assert_equal([-4712, 1, 1], [d.year, d.mon, d.mday])
|
||||
|
@ -243,7 +245,7 @@ class TestDateNew < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError) do
|
||||
Date.__send__(:nth_kday, 2006,5, -5,0)
|
||||
end
|
||||
end if Date.respond_to?(:nth_kday, true)
|
||||
end
|
||||
|
||||
def test_today
|
||||
z = Time.now
|
||||
|
|
|
@ -570,7 +570,8 @@ class TestSH < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_base
|
||||
skip unless defined?(Date.test_all)
|
||||
assert_equal(true, Date.test_all)
|
||||
end if defined?(Date.test_all)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue