summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-07-24 11:15:25 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-07-24 14:44:32 +0900
commite642ddf7ae86e306674559ae745823fdbf56ea10 (patch)
tree2f60c4b4d5509e784e9fbd6cd4dcd69ca78dbb02 /test/ruby
parentf2f9d6ce49aaee6b6414c8442082166cf733ab00 (diff)
[Bug #20647] Disallow `return` directly within a singleton class
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11234
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_class.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb
index 710b8a6f7b..38a6e9eb9f 100644
--- a/test/ruby/test_class.rb
+++ b/test/ruby/test_class.rb
@@ -316,6 +316,7 @@ class TestClass < Test::Unit::TestCase
def test_invalid_return_from_class_definition
assert_syntax_error("class C; return; end", /Invalid return/)
+ assert_syntax_error("class << Object; return; end", /Invalid return/)
end
def test_invalid_yield_from_class_definition