Skip to content

Commit

Permalink
Add specs testing zsuper + multiple _ parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Nov 28, 2016
1 parent a416abe commit 2ae066a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/ruby/language/fixtures/super.rb
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions spec/ruby/language/super_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 2ae066a

Please sign in to comment.