1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2018-01-29 16:08:16 +00:00
parent 1e658d45e1
commit 3fa5bd38af
494 changed files with 4133 additions and 3109 deletions

View file

@ -37,6 +37,6 @@ end
ruby_version_is "2.5" do
describe "Array#append" do
it_behaves_like(:array_push, :append)
it_behaves_like :array_push, :append
end
end

View file

@ -3,9 +3,9 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/collect', __FILE__)
describe "Array#collect" do
it_behaves_like(:array_collect, :collect)
it_behaves_like :array_collect, :collect
end
describe "Array#collect!" do
it_behaves_like(:array_collect_b, :collect!)
it_behaves_like :array_collect_b, :collect!
end

View file

@ -3,7 +3,7 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/slice', __FILE__)
describe "Array#[]" do
it_behaves_like(:array_slice, :[])
it_behaves_like :array_slice, :[]
end
describe "Array.[]" do

View file

@ -350,11 +350,13 @@ describe "Array#[]= with [m..n]" do
it "returns non-array value if non-array value assigned" do
a = [1, 2, 3, 4, 5]
(a[2..4] = 10).should == 10
(a.[]=(2..4, 10)).should == 10
end
it "returns array if array assigned" do
a = [1, 2, 3, 4, 5]
(a[2..4] = [7, 8]).should == [7, 8]
(a.[]=(2..4, [7, 8])).should == [7, 8]
end
it "just sets the section defined by range to nil even if the rhs is nil" do
@ -394,15 +396,32 @@ describe "Array#[]= with [m..n]" do
a.should == [1, 2, 3, 8, 4, 5]
end
it "accepts Range subclasses" do
a = [1, 2, 3, 4]
range_incl = ArraySpecs::MyRange.new(1, 2)
range_excl = ArraySpecs::MyRange.new(-3, -1, true)
describe "Range subclasses" do
before :each do
@range_incl = ArraySpecs::MyRange.new(1, 2)
@range_excl = ArraySpecs::MyRange.new(-3, -1, true)
end
a[range_incl] = ["a", "b"]
a.should == [1, "a", "b", 4]
a[range_excl] = ["A", "B"]
a.should == [1, "A", "B", 4]
it "accepts Range subclasses" do
a = [1, 2, 3, 4]
a[@range_incl] = ["a", "b"]
a.should == [1, "a", "b", 4]
a[@range_excl] = ["A", "B"]
a.should == [1, "A", "B", 4]
end
it "returns non-array value if non-array value assigned" do
a = [1, 2, 3, 4, 5]
(a[@range_incl] = 10).should == 10
(a.[]=(@range_incl, 10)).should == 10
end
it "returns array if array assigned" do
a = [1, 2, 3, 4, 5]
(a[@range_incl] = [7, 8]).should == [7, 8]
a.[]=(@range_incl, [7, 8]).should == [7, 8]
end
end
end

View file

@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/index', __FILE__)
describe "Array#index" do
it_behaves_like(:array_index, :index)
it_behaves_like :array_index, :index
end

View file

@ -3,5 +3,5 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/length', __FILE__)
describe "Array#length" do
it_behaves_like(:array_length, :length)
it_behaves_like :array_length, :length
end

View file

@ -3,9 +3,9 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/collect', __FILE__)
describe "Array#map" do
it_behaves_like(:array_collect, :map)
it_behaves_like :array_collect, :map
end
describe "Array#map!" do
it_behaves_like(:array_collect_b, :map!)
it_behaves_like :array_collect_b, :map!
end

View file

@ -4,6 +4,6 @@ require File.expand_path('../shared/unshift', __FILE__)
ruby_version_is "2.5" do
describe "Array#prepend" do
it_behaves_like(:array_unshift, :prepend)
it_behaves_like :array_unshift, :prepend
end
end

View file

@ -3,5 +3,5 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/push', __FILE__)
describe "Array#push" do
it_behaves_like(:array_push, :push)
it_behaves_like :array_push, :push
end

View file

@ -3,5 +3,5 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/replace', __FILE__)
describe "Array#replace" do
it_behaves_like(:array_replace, :replace)
it_behaves_like :array_replace, :replace
end

View file

@ -3,5 +3,5 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/length', __FILE__)
describe "Array#size" do
it_behaves_like(:array_length, :size)
it_behaves_like :array_length, :size
end

View file

@ -156,5 +156,5 @@ describe "Array#slice!" do
end
describe "Array#slice" do
it_behaves_like(:array_slice, :slice)
it_behaves_like :array_slice, :slice
end

View file

@ -3,5 +3,5 @@ require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/unshift', __FILE__)
describe "Array#unshift" do
it_behaves_like(:array_unshift, :unshift)
it_behaves_like :array_unshift, :unshift
end