summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-07-26 15:14:49 -0700
committerJeremy Evans <code@jeremyevans.net>2019-07-29 09:01:23 -0700
commitaa97410b0a85cb4ceb956ab943b5eee92a128411 (patch)
treec3463f6004d4fe33887e34e9362cc067529700cb /test
parentc2428b8bf6f3646f575c21d0c89192d79130f7cc (diff)
Warn if using return at top-level with an argument
Fixes [Bug #14062]
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index c5c3737b30..f0a22903b1 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1195,6 +1195,10 @@ eom
end
end
+ def test_return_toplevel_with_argument
+ assert_warn(/argument of top-level return is ignored/) {eval("return 1")}
+ end
+
def test_syntax_error_in_rescue
bug12613 = '[ruby-core:76531] [Bug #12613]'
assert_syntax_error("#{<<-"begin;"}\n#{<<-"end;"}", /Invalid retry/, bug12613)