[Ruby 1.9 - Bug #4826][Assigned] Date fails RubySpec

Issue #4826 has been reported by Yui NARUSE.


Bug #4826: Date fails RubySpec

Author: Yui NARUSE
Status: Assigned
Priority: Normal
Assignee: tadayoshi funaba
Category:
Target version:
ruby -v: ruby 1.9.3dev (2011-06-04 trunk 31920) [x86_64-freebsd8.2]

最近の Date の変更で、以下のように RubySpec が失敗しています。
RubySpec 側を直した方がいい物もあるような気がしますが、Date 側の問題もあるようなので確認頂けますか。
spec 側を直すべきものについてはあるべき挙動を教えて頂ければそう直します。

なお、RubySpec は http://rubyspec.org/ です。
RubySpec を実行するには、git をインストールした上で、
make update-rubyspec
すると、spec/rubyspec 下に rubyspec のコードが持ってこられるので、
make test-rubyspec MSPECOPT=‘-V -j -f s /library/date/civil_spec.rb’
などとすれば該当のテストだけを走らせることができます。

Date#civil creats a Date for different calendar reform dates FAILED
Expected 2
to equal 20

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:61:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/civil_spec.rb:5:in <top (required)>’

Date#civil doesn’t blow up (illegal instruction and segfault,
respectively) when fed huge numbers FAILED
Expected FloatDomainError but got RangeError (float Inf out of range of
integer)
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:72:in
block (4 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in each’
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in
block (3 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/civil_spec.rb:5:in <top (required)>’

Date#gregorian? marks a day before the calendar reform as Julian FAILED
Expected true
to equal false

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:8:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:4:in <top (required)>’

Date#gregorian? marks a day after the calendar reform as Julian FAILED
Expected false
to equal true

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:13:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:4:in <top (required)>’

Date#julian? should mark a day before the calendar reform as Julian
FAILED
Expected false
to equal true

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:20:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:16:in <top (required)>’

Date#julian? should mark a day after the calendar reform as Julian
FAILED
Expected true
to equal false

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:25:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:16:in <top (required)>’

Date#new creats a Date for different calendar reform dates FAILED
Expected 2
to equal 20

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:61:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/new_spec.rb:5:in <top (required)>’

Date#new doesn’t blow up (illegal instruction and segfault,
respectively) when fed huge numbers FAILED
Expected FloatDomainError but got RangeError (float Inf out of range of
integer)
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:72:in
block (4 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in each’
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in
block (3 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/new_spec.rb:5:in <top (required)>’

6-12)

$B2~NqF|$O8=<BE*$JHO0O$G!#2~NqF|$NHO0O$,8BDj$5$l$F$$$^$9!#HO0O30$NF|$r;X(B
$BDj$9$k$H7Y9p$N>e$GL5;k$9$k$h$&$K$J$j$^$7$?!#(B

$B%F%9%H$H$7$F>/$7$*$+$7$$!"$3$N%F%9%H$K=q$$$F$"$k(B
BigDecimal::FloatDomainError $B$O0UL#ITL@$G$9!#(B

$B$3$3$GM?$($i$l$F$$$k(B BigDecimal
$B$O!“0JA0$N%3!<%I$G$OIbF0>.?tE@?t$K46@w(B
$B$7$FL58BBg$K$J$k$N$G!”?6Iq$$$O(B Float#floor $B$N$b$N!#(B

$B8=:_$N%3!<%I$G$O!"(BNUM2INT $B$GJQ49$7$h$&$H$9$k$N$G!"(BNUM2INT
$B$N?6Iq$$$K$h(B
$B$k$b$N!#(BBigDecimal $B$OAH$9~$$G$O$J$$L$CN$N?t$G!“JL$K%G%+$$(B
BigDecimal
$B$,Mh$?$H$-$N?6Iq$$$r7h$a$F$$$k$o$1$G$O$”$j$^$;$s!#(B

Issue #4826 has been updated by Yui NARUSE.

Status changed from Assigned to Closed

なるほど、46f643b17d と 0396550b で RubySpec 側を直しました。
ありがとうございました。

Bug #4826: Date fails RubySpec

Author: Yui NARUSE
Status: Closed
Priority: Normal
Assignee: tadayoshi funaba
Category:
Target version:
ruby -v: ruby 1.9.3dev (2011-06-04 trunk 31920) [x86_64-freebsd8.2]

最近の Date の変更で、以下のように RubySpec が失敗しています。
RubySpec 側を直した方がいい物もあるような気がしますが、Date 側の問題もあるようなので確認頂けますか。
spec 側を直すべきものについてはあるべき挙動を教えて頂ければそう直します。

なお、RubySpec は http://rubyspec.org/ です。
RubySpec を実行するには、git をインストールした上で、
make update-rubyspec
すると、spec/rubyspec 下に rubyspec のコードが持ってこられるので、
make test-rubyspec MSPECOPT=‘-V -j -f s /library/date/civil_spec.rb’
などとすれば該当のテストだけを走らせることができます。

Date#civil creats a Date for different calendar reform dates FAILED
Expected 2
to equal 20

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:61:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/civil_spec.rb:5:in <top (required)>’

Date#civil doesn’t blow up (illegal instruction and segfault,
respectively) when fed huge numbers FAILED
Expected FloatDomainError but got RangeError (float Inf out of range of
integer)
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:72:in
block (4 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in each’
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in
block (3 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/civil_spec.rb:5:in <top (required)>’

Date#gregorian? marks a day before the calendar reform as Julian FAILED
Expected true
to equal false

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:8:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:4:in <top (required)>’

Date#gregorian? marks a day after the calendar reform as Julian FAILED
Expected false
to equal true

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:13:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/gregorian_spec.rb:4:in <top (required)>’

Date#julian? should mark a day before the calendar reform as Julian
FAILED
Expected false
to equal true

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:20:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:16:in <top (required)>’

Date#julian? should mark a day after the calendar reform as Julian
FAILED
Expected true
to equal false

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:25:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/julian_spec.rb:16:in <top (required)>’

Date#new creats a Date for different calendar reform dates FAILED
Expected 2
to equal 20

/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:61:in
block (2 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/new_spec.rb:5:in <top (required)>’

Date#new doesn’t blow up (illegal instruction and segfault,
respectively) when fed huge numbers FAILED
Expected FloatDomainError but got RangeError (float Inf out of range of
integer)
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:72:in
block (4 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in each’
/usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/shared/civil.rb:71:in
block (3 levels) in <top (required)>' /usr/home/chkbuild/build/ruby-trunk/20110604T110102Z/rubyspec/library/date/new_spec.rb:5:in <top (required)>’