1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-04-27 18:53:23 +02:00
parent 00c33d9c23
commit a1b4816759
193 changed files with 3026 additions and 3387 deletions

View file

@ -22,6 +22,16 @@ describe "A lambda literal -> () { }" do
-> () { }.lambda?.should be_true
end
ruby_version_is "2.6" do
it "may include a rescue clause" do
eval('-> do raise ArgumentError; rescue ArgumentError; 7; end').should be_an_instance_of(Proc)
end
it "may include a ensure clause" do
eval('-> do 1; ensure; 2; end').should be_an_instance_of(Proc)
end
end
it "has its own scope for local variables" do
l = -> arg {
var = arg
@ -305,6 +315,13 @@ describe "A lambda expression 'lambda { ... }'" do
lambda { lambda }.should raise_error(ArgumentError)
end
ruby_version_is "2.5" do
it "may include a rescue clause" do
eval('lambda do raise ArgumentError; rescue ArgumentError; 7; end').should be_an_instance_of(Proc)
end
end
context "with an implicit block" do
before do
def meth; lambda; end