1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-02-28 19:07:17 +01:00
parent 5d21050182
commit a0f5ff4c3c
75 changed files with 851 additions and 143 deletions

View file

@ -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