mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Spec: Fix spec/ruby/core/array/reject_spec.rb & misc
Patch by @MSP-Greg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c312111c7c
commit
bf6c9a5c6d
2 changed files with 8 additions and 9 deletions
|
@ -13,15 +13,11 @@ module ArraySpecs
|
||||||
SampleCount = 1000
|
SampleCount = 1000
|
||||||
|
|
||||||
def self.frozen_array
|
def self.frozen_array
|
||||||
frozen_array = [1,2,3]
|
[1,2,3].freeze
|
||||||
frozen_array.freeze
|
|
||||||
frozen_array
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.empty_frozen_array
|
def self.empty_frozen_array
|
||||||
frozen_array = []
|
[].freeze
|
||||||
frozen_array.freeze
|
|
||||||
frozen_array
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.recursive_array
|
def self.recursive_array
|
||||||
|
|
|
@ -126,10 +126,13 @@ describe "Array#reject!" do
|
||||||
a = [1, 2, 3, 4]
|
a = [1, 2, 3, 4]
|
||||||
begin
|
begin
|
||||||
a.reject! do |x|
|
a.reject! do |x|
|
||||||
return true if x == 2
|
case x
|
||||||
raise raise StandardError, 'Oops' if x == 3
|
when 2 then true
|
||||||
|
when 3 then raise StandardError, 'Oops'
|
||||||
|
else false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue StandardError
|
||||||
end
|
end
|
||||||
|
|
||||||
a.should == [1, 3, 4]
|
a.should == [1, 3, 4]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue