Project

General

Profile

Actions

Bug #4826

closed

Date fails RubySpec

Added by naruse (Yui NARUSE) almost 13 years ago. Updated almost 13 years ago.

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

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

Updated by tadf (tadayoshi funaba) almost 13 years ago

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

6-12)

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

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

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

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

Updated by naruse (Yui NARUSE) almost 13 years ago

  • Status changed from Assigned to Closed

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

Actions

Also available in: Atom PDF

Like0
Like0Like0