summaryrefslogtreecommitdiff
path: root/test/ruby/test_require.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-04 15:21:49 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-04 16:10:39 +0900
commit7d6903dc476f982e7b432adbeef3a3d9372a309f (patch)
tree3847e6cc91b7ca311fda9cd885a0bef908bf898a /test/ruby/test_require.rb
parent9cdc964d075fc3d21b8ce8456ac88f57a5183ec0 (diff)
Add the loaded feature after no exception raised
Retrying after rescued `require` should try to load the same library again. [Bug #16607]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2879
Diffstat (limited to 'test/ruby/test_require.rb')
-rw-r--r--test/ruby/test_require.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 7e53a02fb8..000ae99fed 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -216,6 +216,13 @@ class TestRequire < Test::Unit::TestCase
assert_syntax_error_backtrace {|req| require req}
end
+ def test_require_syntax_error_rescued
+ assert_syntax_error_backtrace do |req|
+ assert_raise_with_message(SyntaxError, /unexpected/) {require req}
+ require req
+ end
+ end
+
def test_load_syntax_error
assert_syntax_error_backtrace {|req| load req}
end