Skip to content

Commit

Permalink
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/ruby/language/fixtures/super.rb
Original file line number Diff line number Diff line change
@@ -455,6 +455,29 @@ def m_modified(a, b, *args)
end
end

module ZSuperWithUnderscores
class A
def m(*args)
args
end

def m_modified(*args)
args
end
end

class B < A
def m(_, _)
super
end

def m_modified(_, _)
_ = 14
super
end
end
end

module KeywordArguments
class A
def foo(**args)
8 changes: 8 additions & 0 deletions spec/ruby/language/super_spec.rb
Original file line number Diff line number Diff line change
@@ -239,6 +239,14 @@ def obj.foobar(array)
Super::ZSuperWithRestAndOthers::B.new.m_modified(1, 2, 3, 4, 5).should == [3, 14, 5]
end

it "without explicit arguments that are '_'" do
Super::ZSuperWithUnderscores::B.new.m(1, 2).should == [1, 2]
end

it "without explicit arguments that are '_' including any modifications" do
Super::ZSuperWithUnderscores::B.new.m_modified(1, 2).should == [14, 2]
end

describe 'when using keyword arguments' do
it 'passes any given keyword arguments to the parent' do
b = Super::KeywordArguments::B.new

0 comments on commit 2ae066a

Please sign in to comment.