зеркало из https://github.com/github/ruby.git
Fix r66772
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e4f46eabab
Коммит
d03771d85a
|
@ -20,15 +20,19 @@ describe "Proc as a block pass argument" do
|
|||
end
|
||||
end
|
||||
|
||||
ruby_version_is ""..."2.7" do
|
||||
ruby_version_is ""..."2.8" do
|
||||
describe "Proc as an implicit block pass argument" do
|
||||
def revivify
|
||||
Proc.new
|
||||
end
|
||||
|
||||
it "remains the same object if re-vivified by the target method" do
|
||||
warning = ruby_version_is("2.7") {/tried to create Proc object without a block/}
|
||||
warning ||= ''
|
||||
|
||||
p = Proc.new {}
|
||||
p2 = revivify(&p)
|
||||
p2 = nil
|
||||
-> {p2 = revivify(&p)}.should complain(warning)
|
||||
p.should equal p2
|
||||
p.should == p2
|
||||
end
|
||||
|
@ -41,18 +45,3 @@ ruby_version_is ""..."2.7" do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.7" do
|
||||
describe "Proc called with no block" do
|
||||
def revivify
|
||||
Proc.new
|
||||
end
|
||||
|
||||
it "raises ArgumentError when called with no block" do
|
||||
p = Proc.new {}
|
||||
-> {
|
||||
revivify(&p)
|
||||
}.should
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче