mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@0fe33ac
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f989b87a0
commit
a34db218ad
162 changed files with 1267 additions and 621 deletions
|
@ -30,8 +30,8 @@ describe "Array#<<" do
|
|||
a.should == [:foo]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array << 5 }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array << 5 }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ describe "Array#clear" do
|
|||
a.untrusted?.should be_true
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
a = [1]
|
||||
a.freeze
|
||||
lambda { a.clear }.should raise_error(RuntimeError)
|
||||
lambda { a.clear }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -71,7 +71,7 @@ describe "Array#compact!" do
|
|||
a.untrusted?.should be_true
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.compact! }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.compact! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,13 +32,13 @@ describe "Array#concat" do
|
|||
[].concat(obj).should == [5, 6, 7]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError when Array is frozen and modification occurs" do
|
||||
lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} when Array is frozen and modification occurs" do
|
||||
lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
# see [ruby-core:23666]
|
||||
it "raises a RuntimeError when Array is frozen and no modification occurs" do
|
||||
lambda { ArraySpecs.frozen_array.concat([]) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} when Array is frozen and no modification occurs" do
|
||||
lambda { ArraySpecs.frozen_array.concat([]) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "keeps tainted status" do
|
||||
|
|
|
@ -35,8 +35,8 @@ describe "Array#delete_at" do
|
|||
a.delete_at(-2).should == 1
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { [1,2,3].freeze.delete_at(0) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { [1,2,3].freeze.delete_at(0) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "keeps tainted status" do
|
||||
|
|
|
@ -39,12 +39,12 @@ describe "Array#delete_if" do
|
|||
@a.freeze.delete_if.should be_an_instance_of(Enumerator)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.delete_if {} }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.delete_if {} }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "keeps tainted status" do
|
||||
|
|
|
@ -40,8 +40,8 @@ describe "Array#delete" do
|
|||
[1, 2, 3].freeze.delete(0).should == nil
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "keeps tainted status" do
|
||||
|
|
|
@ -94,8 +94,8 @@ describe "Array#[]=" do
|
|||
|
||||
it "checks frozen before attempting to coerce arguments" do
|
||||
a = [1,2,3,4].freeze
|
||||
lambda {a[:foo] = 1}.should raise_error(RuntimeError)
|
||||
lambda {a[:foo, :bar] = 1}.should raise_error(RuntimeError)
|
||||
lambda {a[:foo] = 1}.should raise_error(frozen_error_class)
|
||||
lambda {a[:foo, :bar] = 1}.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "sets elements in the range arguments when passed ranges" do
|
||||
|
@ -236,8 +236,8 @@ describe "Array#[]=" do
|
|||
ary.should == [5, 6, 7]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array[0, 0] = [] }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -43,12 +43,12 @@ describe "Array#fill" do
|
|||
[nil, nil, nil, nil].fill { |i| i * 2 }.should == [0, 2, 4, 6]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.fill('x') }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.fill('x') }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.fill('x') }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises an ArgumentError if 4 or more arguments are passed when no block given" do
|
||||
|
|
|
@ -272,15 +272,15 @@ describe "Array#flatten!" do
|
|||
ary.should == [1, 2, 3]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on frozen arrays when the array is modified" do
|
||||
it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
|
||||
nested_ary = [1, 2, []]
|
||||
nested_ary.freeze
|
||||
lambda { nested_ary.flatten! }.should raise_error(RuntimeError)
|
||||
lambda { nested_ary.flatten! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
# see [ruby-core:23663]
|
||||
it "raises a RuntimeError on frozen arrays when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.flatten! }.should raise_error(RuntimeError)
|
||||
lambda { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.flatten! }.should raise_error(frozen_error_class)
|
||||
lambda { ArraySpecs.empty_frozen_array.flatten! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,13 +32,13 @@ describe "Array#initialize" do
|
|||
end.should raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on frozen arrays" do
|
||||
it "raises a #{frozen_error_class} on frozen arrays" do
|
||||
lambda do
|
||||
ArraySpecs.frozen_array.send :initialize
|
||||
end.should raise_error(RuntimeError)
|
||||
end.should raise_error(frozen_error_class)
|
||||
lambda do
|
||||
ArraySpecs.frozen_array.send :initialize, ArraySpecs.frozen_array
|
||||
end.should raise_error(RuntimeError)
|
||||
end.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "calls #to_ary to convert the value to an array, even if it's private" do
|
||||
|
|
|
@ -67,12 +67,12 @@ describe "Array#insert" do
|
|||
lambda { [].insert() }.should raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on frozen arrays when the array is modified" do
|
||||
lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on frozen arrays when the array is modified" do
|
||||
lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
# see [ruby-core:23666]
|
||||
it "raises a RuntimeError on frozen arrays when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.insert(0) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on frozen arrays when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.insert(0) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,10 +5,7 @@ require File.expand_path('../shared/numeric_basic', __FILE__)
|
|||
require File.expand_path('../shared/integer', __FILE__)
|
||||
|
||||
ruby_version_is '2.3' do
|
||||
# To handle the special case of x64-mingw32
|
||||
pointer_size = RUBY_PLATFORM =~ /\bx64\b/ ? 64 : 1.size * 8
|
||||
|
||||
guard -> { pointer_size == 64 } do
|
||||
platform_is pointer_size: 64 do
|
||||
describe "Array#pack with format 'J'" do
|
||||
it_behaves_like :array_pack_basic, 'J'
|
||||
it_behaves_like :array_pack_basic_non_float, 'J'
|
||||
|
@ -114,7 +111,7 @@ ruby_version_is '2.3' do
|
|||
end
|
||||
end
|
||||
|
||||
guard -> { pointer_size == 32 } do
|
||||
platform_is pointer_size: 32 do
|
||||
describe "Array#pack with format 'J'" do
|
||||
it_behaves_like :array_pack_basic, 'J'
|
||||
it_behaves_like :array_pack_basic_non_float, 'J'
|
||||
|
|
|
@ -38,12 +38,12 @@ describe "Array#pop" do
|
|||
a.tainted?.should be_true
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.pop }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.pop }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.pop }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.pop }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "keeps untrusted status" do
|
||||
|
@ -152,9 +152,9 @@ describe "Array#pop" do
|
|||
ary.pop(0).untrusted?.should be_false
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.pop(2) }.should raise_error(RuntimeError)
|
||||
lambda { ArraySpecs.frozen_array.pop(0) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.pop(2) }.should raise_error(frozen_error_class)
|
||||
lambda { ArraySpecs.frozen_array.pop(0) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "keeps untrusted status" do
|
||||
|
|
|
@ -103,12 +103,12 @@ describe "Array#reject!" do
|
|||
ArraySpecs.frozen_array.reject!.should be_an_instance_of(Enumerator)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.reject! {} }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.reject! {} }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.reject! {} }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it_behaves_like :enumeratorize, :reject!
|
||||
|
|
|
@ -36,7 +36,7 @@ describe "Array#reverse!" do
|
|||
array.reverse!.should == [array, array, array, array, array, 3.0, 'two', 1]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.reverse! }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.reverse! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -121,9 +121,9 @@ describe "Array#rotate!" do
|
|||
a.should == []
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { [1, 2, 3].freeze.rotate!(0) }.should raise_error(RuntimeError)
|
||||
lambda { [1].freeze.rotate!(42) }.should raise_error(RuntimeError)
|
||||
lambda { [].freeze.rotate! }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { [1, 2, 3].freeze.rotate!(0) }.should raise_error(frozen_error_class)
|
||||
lambda { [1].freeze.rotate!(42) }.should raise_error(frozen_error_class)
|
||||
lambda { [].freeze.rotate! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -110,22 +110,22 @@ describe :array_collect_b, shared: true do
|
|||
end
|
||||
|
||||
describe "when frozen" do
|
||||
it "raises a RuntimeError" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class}" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError when empty" do
|
||||
lambda { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} when empty" do
|
||||
lambda { ArraySpecs.empty_frozen_array.send(@method) {} }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError when calling #each on the returned Enumerator" do
|
||||
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator" do
|
||||
enumerator = ArraySpecs.frozen_array.send(@method)
|
||||
lambda { enumerator.each {|x| x } }.should raise_error(RuntimeError)
|
||||
lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError when calling #each on the returned Enumerator when empty" do
|
||||
it "raises a #{frozen_error_class} when calling #each on the returned Enumerator when empty" do
|
||||
enumerator = ArraySpecs.empty_frozen_array.send(@method)
|
||||
lambda { enumerator.each {|x| x } }.should raise_error(RuntimeError)
|
||||
lambda { enumerator.each {|x| x } }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ describe :keep_if, shared: true do
|
|||
@frozen.should == @origin
|
||||
end
|
||||
|
||||
it "raises a RuntimeError" do
|
||||
lambda { @frozen.send(@method) { true } }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class}" do
|
||||
lambda { @frozen.send(@method) { true } }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -52,8 +52,8 @@ describe :keep_if, shared: true do
|
|||
@frozen.should == @origin
|
||||
end
|
||||
|
||||
it "raises a RuntimeError" do
|
||||
lambda { @frozen.send(@method) { false } }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class}" do
|
||||
lambda { @frozen.send(@method) { false } }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,8 +26,8 @@ describe :array_push, shared: true do
|
|||
array.send(@method, :last).should == [1, 'two', 3.0, array, array, array, array, array, :last]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(RuntimeError)
|
||||
lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
|
||||
lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,9 +52,9 @@ describe :array_replace, shared: true do
|
|||
[].send(@method, ArraySpecs::ToAryArray[5, 6, 7]).should == [5, 6, 7]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda {
|
||||
ArraySpecs.frozen_array.send(@method, ArraySpecs.frozen_array)
|
||||
}.should raise_error(RuntimeError)
|
||||
}.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,12 +35,12 @@ describe :array_unshift, shared: true do
|
|||
array[0..5].should == [:new, 1, 'two', 3.0, array, array]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array when the array is modified" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method, 1) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
# see [ruby-core:23666]
|
||||
it "raises a RuntimeError on a frozen array when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.send(@method) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,11 +30,11 @@ describe "Array#shift" do
|
|||
array[0..2].should == ['two', 3.0, array]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.shift }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.shift }.should raise_error(frozen_error_class)
|
||||
end
|
||||
it "raises a RuntimeError on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.shift }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.shift }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
describe "passed a number n as an argument" do
|
||||
|
|
|
@ -95,8 +95,8 @@ describe "Array#shuffle!" do
|
|||
a.should equal(original)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.shuffle! }.should raise_error(RuntimeError)
|
||||
lambda { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.shuffle! }.should raise_error(frozen_error_class)
|
||||
lambda { ArraySpecs.empty_frozen_array.shuffle! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -150,8 +150,8 @@ describe "Array#slice!" do
|
|||
a.should == [1, 2]
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.slice!(0, 0) }.should raise_error(frozen_error_class)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ describe "Array#sort_by!" do
|
|||
a.should be_an_instance_of(Array)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on an empty frozen array" do
|
||||
lambda { ArraySpecs.empty_frozen_array.sort_by! {}}.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "returns the specified value when it would break in the given block" do
|
||||
|
|
|
@ -233,8 +233,8 @@ describe "Array#sort!" do
|
|||
a.sort!{ -1 }.should be_an_instance_of(Array)
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.sort! }.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.sort! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "returns the specified value when it would break in the given block" do
|
||||
|
|
|
@ -188,20 +188,20 @@ describe "Array#uniq!" do
|
|||
[ "a", "b", "c" ].uniq!.should == nil
|
||||
end
|
||||
|
||||
it "raises a RuntimeError on a frozen array when the array is modified" do
|
||||
it "raises a #{frozen_error_class} on a frozen array when the array is modified" do
|
||||
dup_ary = [1, 1, 2]
|
||||
dup_ary.freeze
|
||||
lambda { dup_ary.uniq! }.should raise_error(RuntimeError)
|
||||
lambda { dup_ary.uniq! }.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
# see [ruby-core:23666]
|
||||
it "raises a RuntimeError on a frozen array when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.uniq!}.should raise_error(RuntimeError)
|
||||
lambda { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(RuntimeError)
|
||||
it "raises a #{frozen_error_class} on a frozen array when the array would not be modified" do
|
||||
lambda { ArraySpecs.frozen_array.uniq!}.should raise_error(frozen_error_class)
|
||||
lambda { ArraySpecs.empty_frozen_array.uniq!}.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "doesn't yield to the block on a frozen array" do
|
||||
lambda { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(RuntimeError)
|
||||
lambda { ArraySpecs.frozen_array.uniq!{ raise RangeError, "shouldn't yield"}}.should raise_error(frozen_error_class)
|
||||
end
|
||||
|
||||
it "compares elements based on the value returned from the block" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue