mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@3affe1e
This commit is contained in:
parent
6ae81d49b5
commit
45cf4f2187
277 changed files with 3844 additions and 7624 deletions
|
@ -197,32 +197,15 @@ describe "An instance method with a default argument" do
|
|||
foo(2,3,3).should == [2,3,[3]]
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.7' do
|
||||
it "warns and uses a nil value when there is an existing local method with same name" do
|
||||
def bar
|
||||
1
|
||||
end
|
||||
-> {
|
||||
eval "def foo(bar = bar)
|
||||
bar
|
||||
end"
|
||||
}.should complain(/circular argument reference/)
|
||||
foo.should == nil
|
||||
foo(2).should == 2
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is '2.7' do
|
||||
it "raises a SyntaxError when there is an existing method with the same name as the local variable" do
|
||||
def bar
|
||||
1
|
||||
end
|
||||
-> {
|
||||
eval "def foo(bar = bar)
|
||||
bar
|
||||
end"
|
||||
}.should raise_error(SyntaxError)
|
||||
it "raises a SyntaxError when there is an existing method with the same name as the local variable" do
|
||||
def bar
|
||||
1
|
||||
end
|
||||
-> {
|
||||
eval "def foo(bar = bar)
|
||||
bar
|
||||
end"
|
||||
}.should raise_error(SyntaxError)
|
||||
end
|
||||
|
||||
it "calls a method with the same name as the local when explicitly using ()" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue