Project

General

Profile

Bug #4826

Date fails RubySpec

Added by naruse (Yui NARUSE) about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3dev (2011-06-04 trunk 31920) [x86_64-freebsd8.2]
Backport:
[ruby-dev:43624]

Description

最近の 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'
などとすれば該当のテストだけを走らせることができます。

6)
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
'

7)
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
'

8)
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
'

9)
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
'

10)
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
'

11)
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
'

12)
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
'

13)
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
'

History

Updated by tadf (tadayoshi funaba) about 8 years ago

  • ruby -v changed from ruby 1.9.3dev (2011-06-04 trunk 31920) [x86_64-freebsd8.2] to -

6-12)

改暦日は現実的な範囲で。改暦日の範囲が限定されています。範囲外の日を指
定すると警告の上で無視するようになりました。

13)

テストとして少しおかしい、このテストに書いてある
BigDecimal::FloatDomainError は意味不明です。

ここで与えられている BigDecimal は、以前のコードでは浮動小数点数に感染
して無限大になるので、振舞いは Float#floor のもの。

現在のコードでは、NUM2INT で変換しようとするので、NUM2INT の振舞いによ
るもの。BigDecimal は組み込みではない未知の数で、別にデカい BigDecimal
が来たときの振舞いを決めているわけではありません。

Updated by naruse (Yui NARUSE) about 8 years ago

  • Status changed from Assigned to Closed

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

Also available in: Atom PDF