summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorLuke Gruber <luke.gru@gmail.com>2024-09-07 12:17:08 -0400
committerKevin Newton <kddnewton@gmail.com>2024-09-11 16:41:46 -0400
commit5d358b660d41e64de301f428dc0300a52a6f9566 (patch)
tree69e684e87941e0001e1446664b2a7e53af49fd25 /test/ruby
parentd4d6f1de83628b12e4a27d273edace7762f69860 (diff)
Fix issue with super and forwarding arguments in prism_compile.c
Fixes [Bug #20720]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11565
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_super.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index ce78e66c52..aa09f9e1b9 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -8,6 +8,7 @@ class TestSuper < Test::Unit::TestCase
def array(*a) a end
def optional(a = 0) a end
def keyword(**a) a end
+ def forward(*a) a end
end
class Single1 < Base
def single(*) super end
@@ -63,6 +64,16 @@ class TestSuper < Test::Unit::TestCase
[x, y]
end
end
+ class Forward < Base
+ def forward(...)
+ w = super()
+ x = super
+ y = super(...)
+ a = 1
+ z = super(a, ...)
+ [w, x, y, z]
+ end
+ end
def test_single1
assert_equal(1, Single1.new.single(1))
@@ -133,6 +144,11 @@ class TestSuper < Test::Unit::TestCase
def test_keyword2
assert_equal([{foo: "changed1"}, {foo: "changed2"}], Keyword2.new.keyword)
end
+ def test_forwardable(...)
+ assert_equal([[],[],[],[1]], Forward.new.forward())
+ assert_equal([[],[1,2],[1,2],[1,1,2]], Forward.new.forward(1,2))
+ assert_equal([[],[:test],[:test],[1,:test]], Forward.new.forward(:test, ...))
+ end
class A
def tt(aa)