mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@15c9619
This commit is contained in:
parent
00c33d9c23
commit
a1b4816759
193 changed files with 3026 additions and 3387 deletions
|
@ -217,6 +217,12 @@ describe "A block" do
|
|||
it "does not raise an exception when values are yielded" do
|
||||
@y.s(0) { 1 }.should == 1
|
||||
end
|
||||
|
||||
ruby_version_is "2.5" do
|
||||
it "may include a rescue clause" do
|
||||
eval("@y.z do raise ArgumentError; rescue ArgumentError; 7; end").should == 7
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "taking || arguments" do
|
||||
|
@ -227,6 +233,12 @@ describe "A block" do
|
|||
it "does not raise an exception when values are yielded" do
|
||||
@y.s(0) { || 1 }.should == 1
|
||||
end
|
||||
|
||||
ruby_version_is "2.5" do
|
||||
it "may include a rescue clause" do
|
||||
eval('@y.z do || raise ArgumentError; rescue ArgumentError; 7; end').should == 7
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "taking |a| arguments" do
|
||||
|
@ -252,6 +264,12 @@ describe "A block" do
|
|||
it "does not destructure a single Array value" do
|
||||
@y.s([1, 2]) { |a| a }.should == [1, 2]
|
||||
end
|
||||
|
||||
ruby_version_is "2.5" do
|
||||
it "may include a rescue clause" do
|
||||
eval('@y.s(1) do |x| raise ArgumentError; rescue ArgumentError; 7; end').should == 7
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "taking |a, b| arguments" do
|
||||
|
@ -626,6 +644,12 @@ describe "A block" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "taking |*a, b:|" do
|
||||
it "merges the hash into the splatted array" do
|
||||
@y.k { |*a, b:| [a, b] }.should == [[], true]
|
||||
end
|
||||
end
|
||||
|
||||
describe "arguments with _" do
|
||||
it "extracts arguments with _" do
|
||||
@y.m([[1, 2, 3], 4]) { |(_, a, _), _| a }.should == 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue