Issue #15432 has been updated by Eregon (Benoit Daloze).


Actually, the `should_not` above indeed doesn't make much sense, because it relies on `nan_value` returning different NaNs, which is probably platform-specific.

I added a spec for this case: `[Float::NAN].should == [Float::NAN]`.

----------------------------------------
Bug #15432: Float の NaN のみを含む配列比較のテスト
https://bugs.ruby-lang.org/issues/15432#change-78915

* Author: shuujii (Shuji KOBAYASHI)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Float の NaN のみを含む配列比較のテストが以下にあります。

~~~ ruby
## spec/ruby/core/array/equal_value_spec.rb:47

# As per bug #1720
it "returns false for [NaN] == [NaN]" do
  [nan_value].should_not == [nan_value]
end
~~~

しかし、これは #1720 で未定義動作とするとなったと思うので不要ではないでしょうか。

現状では以下のようになるので意味のないテストだと思います。

~~~ ruby
[Float::NAN] == [Float::NAN]  #=> true
[Float::NAN] == [0/0.0]       #=> false
~~~ 



-- 
https://bugs.ruby-lang.org/