ruby-changes:65078
From: Nobuyoshi <ko1@a...>
Date: Fri, 29 Jan 2021 11:36:40 +0900 (JST)
Subject: [ruby-changes:65078] 522adbc945 (master): Fixed Kernel#rand spec
https://git.ruby-lang.org/ruby.git/commit/?id=522adbc945 From 522adbc945c209f4993b0d0ee84a44c333de350f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 29 Jan 2021 08:37:37 +0900 Subject: Fixed Kernel#rand spec Float should not be compared by identity. --- spec/ruby/core/kernel/rand_spec.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/ruby/core/kernel/rand_spec.rb b/spec/ruby/core/kernel/rand_spec.rb index 481189d..c52faee 100644 --- a/spec/ruby/core/kernel/rand_spec.rb +++ b/spec/ruby/core/kernel/rand_spec.rb @@ -119,9 +119,9 @@ describe "Kernel.rand" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/rand_spec.rb#L119 context "given an inclusive range between 0 and 1" do it "returns an Integer between the two Integers" do - x = rand(0..1) - x.should be_kind_of(Integer) - (0..1).should include(x) + x = rand(0..1) + x.should be_kind_of(Integer) + (0..1).should include(x) end it "returns a Float if at least one side is Float" do @@ -131,8 +131,8 @@ describe "Kernel.rand" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/rand_spec.rb#L131 x3 = Random.new(seed).rand(0.0..1) x3.should be_kind_of(Float) - x1.should equal(x3) - x2.should equal(x3) + x1.should eql(x3) + x2.should eql(x3) (0.0..1.0).should include(x3) end @@ -140,9 +140,9 @@ describe "Kernel.rand" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/rand_spec.rb#L140 context "given an exclusive range between 0 and 1" do it "returns zero as an Integer" do - x = rand(0...1) - x.should be_kind_of(Integer) - x.should eql(0) + x = rand(0...1) + x.should be_kind_of(Integer) + x.should eql(0) end it "returns a Float if at least one side is Float" do @@ -152,8 +152,8 @@ describe "Kernel.rand" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/kernel/rand_spec.rb#L152 x3 = Random.new(seed).rand(0.0...1) x3.should be_kind_of(Float) - x1.should equal(x3) - x2.should equal(x3) + x1.should eql(x3) + x2.should eql(x3) (0.0...1.0).should include(x3) end -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/