Skip to content

Commit 558c7c1

Browse files
committed
Add a spec for zsuper passing splat and keyword arguments together
1 parent 18d2f10 commit 558c7c1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

spec/ruby/language/fixtures/super.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,4 +347,18 @@ def foo(a:, b: 'b', **)
347347
end
348348
end
349349
end
350+
351+
module SplatAndKeyword
352+
class A
353+
def foo(*args, **options)
354+
[args, options]
355+
end
356+
end
357+
358+
class B < A
359+
def foo(*args, **options)
360+
super
361+
end
362+
end
363+
end
350364
end

spec/ruby/language/super_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,13 @@ def a(arg)
177177

178178
b.foo.should == {}
179179
end
180+
181+
describe 'when using splat arguments' do
182+
it 'passes splat arguments and keyword arguments to the parent' do
183+
b = Super::SplatAndKeyword::B.new
184+
185+
b.foo('bar', baz: true).should == [['bar'], {baz: true}]
186+
end
187+
end
180188
end
181189
end

0 commit comments

Comments
 (0)