ruby-changes:59023
From: Benoit <ko1@a...>
Date: Sun, 1 Dec 2019 23:30:03 +0900 (JST)
Subject: [ruby-changes:59023] 617a3735ae (master): Update to ruby/spec@dcf4955
https://git.ruby-lang.org/ruby.git/commit/?id=617a3735ae From 617a3735aedc12fe82b6806d6d3a37c3f977fef1 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Sun, 1 Dec 2019 14:11:42 +0100 Subject: Update to ruby/spec@dcf4955 diff --git a/spec/ruby/core/array/shared/slice.rb b/spec/ruby/core/array/shared/slice.rb index 73456eb..1e7fdf9 100644 --- a/spec/ruby/core/array/shared/slice.rb +++ b/spec/ruby/core/array/shared/slice.rb @@ -117,6 +117,27 @@ describe :array_slice, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/shared/slice.rb#L117 a.send(@method, 0, obj).should == [1, 2] end + it "raises TypeError if to_int returns non-integer" do + from = mock('from') + to = mock('to') + + # So we can construct a range out of them... + def from.<=>(o) 0 end + def to.<=>(o) 0 end + + a = [1, 2, 3, 4, 5] + + def from.to_int() 'cat' end + def to.to_int() -2 end + + -> { a.send(@method, from..to) }.should raise_error(TypeError) + + def from.to_int() 1 end + def to.to_int() 'cat' end + + -> { a.send(@method, from..to) }.should raise_error(TypeError) + end + it "returns the elements specified by Range indexes with [m..n]" do [ "a", "b", "c", "d", "e" ].send(@method, 1..3).should == ["b", "c", "d"] [ "a", "b", "c", "d", "e" ].send(@method, 4..-1).should == ['e'] -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/