From a0f5ff4c3cd05f8717be2bf1d79f0817f288d398 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 28 Feb 2020 19:07:17 +0100 Subject: Update to ruby/spec@41bf282 --- spec/ruby/core/array/shared/slice.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'spec/ruby/core/array') diff --git a/spec/ruby/core/array/shared/slice.rb b/spec/ruby/core/array/shared/slice.rb index 1e7fdf934a..d6b4547b2b 100644 --- a/spec/ruby/core/array/shared/slice.rb +++ b/spec/ruby/core/array/shared/slice.rb @@ -461,7 +461,7 @@ describe :array_slice, shared: true do it "raises a RangeError when the start index is out of range of Fixnum" do array = [1, 2, 3, 4, 5, 6] obj = mock('large value') - obj.should_receive(:to_int).and_return(0x8000_0000_0000_0000_0000) + obj.should_receive(:to_int).and_return(bignum_value) -> { array.send(@method, obj) }.should raise_error(RangeError) obj = 8e19 @@ -471,10 +471,19 @@ describe :array_slice, shared: true do it "raises a RangeError when the length is out of range of Fixnum" do array = [1, 2, 3, 4, 5, 6] obj = mock('large value') - obj.should_receive(:to_int).and_return(0x8000_0000_0000_0000_0000) + obj.should_receive(:to_int).and_return(bignum_value) -> { array.send(@method, 1, obj) }.should raise_error(RangeError) obj = 8e19 -> { array.send(@method, 1, obj) }.should raise_error(RangeError) end + + it "raises a type error if a range is passed with a length" do + ->{ [1, 2, 3].send(@method, 1..2, 1) }.should raise_error(TypeError) + end + + it "raises a RangeError if passed a range with a bound that is too large" do + -> { "hello".send(@method, bignum_value..(bignum_value + 1)) }.should raise_error(RangeError) + -> { "hello".send(@method, 0..bignum_value) }.should raise_error(RangeError) + end end -- cgit v1.2.3