summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-03-26 10:04:54 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-03-26 17:37:47 +0900
commita850cd1a87bef738c40d9c550fb8823699083f2e (patch)
tree352a30b207e197d5dc3241c3449f3ae1b54b894f /test/ruby
parent3680981c7b71df8c3a426164787ccefe5296bb25 (diff)
[Bug #20392] Block arguments duplication check at `super`
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 42108f955f..371c41fe37 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -2154,6 +2154,13 @@ eom
assert_equal 0...1, exp.call(a: 0)
end
+ def test_argument_forwarding_with_super
+ assert_valid_syntax('def foo(...) super {}; end')
+ assert_valid_syntax('def foo(...) super() {}; end')
+ assert_syntax_error('def foo(...) super(...) {}; end', /both block arg and actual block/)
+ assert_syntax_error('def foo(...) super(1, ...) {}; end', /both block arg and actual block/)
+ end
+
def test_class_module_Object_ancestors
assert_separately([], <<-RUBY)
m = Module.new