diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/prism/errors/dont_allow_return_inside_sclass_body.txt | 3 | ||||
-rw-r--r-- | test/ruby/test_class.rb | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/test/prism/errors/dont_allow_return_inside_sclass_body.txt b/test/prism/errors/dont_allow_return_inside_sclass_body.txt new file mode 100644 index 0000000000..c29fe01728 --- /dev/null +++ b/test/prism/errors/dont_allow_return_inside_sclass_body.txt @@ -0,0 +1,3 @@ +class << A; return; end + ^~~~~~ Invalid return in class/module body + 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 |