summaryrefslogtreecommitdiff
path: root/test/ruby/test_syntax.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-10-12 00:26:39 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-10-12 00:40:55 +0900
commit4ed0c33d13ff0d2544aaf36e8e4f071b900d10cd (patch)
treede93b6343b6f4b7f7b17483018f0be5000d8db5e /test/ruby/test_syntax.rb
parent27b48089e2bdc3b0719e75ae8685a496ef8fa9e3 (diff)
Prohibit setter method names in all kinds of endless methods
Also unwrap NODE_RIPPER to check the method name.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3649
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r--test/ruby/test_syntax.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index fb982e8a1f..0542d4f90d 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1429,7 +1429,12 @@ eom
end
assert_equal("class ok", k.rescued("ok"))
assert_equal("instance ok", k.new.rescued("ok"))
- assert_syntax_error('def foo=() = 42', /setter method cannot be defined in an endless method definition/)
+
+ error = /setter method cannot be defined in an endless method definition/
+ assert_syntax_error('def foo=() = 42', error)
+ assert_syntax_error('def obj.foo=() = 42', error)
+ assert_syntax_error('def foo=() = 42 rescue nil', error)
+ assert_syntax_error('def obj.foo=() = 42 rescue nil', error)
end
def test_methoddef_in_cond