summaryrefslogtreecommitdiff
path: root/test/irb/helper.rb
diff options
context:
space:
mode:
authorlukeg <[email protected]>2023-03-15 12:38:35 -0400
committergit <[email protected]>2023-03-17 15:19:40 +0000
commit418cf344fb5f6a69c47039e63b1b7db2a0cd66e3 (patch)
tree05b7206cd204efc7bc025eb8fcf63f022c31f52f /test/irb/helper.rb
parenta206ee670969ce213ec0da4d1d5b65d24259efd4 (diff)
[ruby/irb] Fix 2 minor issues in test suite
* undefine Kernel#irb_original_require in without_rdoc method * Don't rescue all LoadErrors/NameErrors in test_rendering.rb, just the one for require 'yamatanooroti' https://github.com/ruby/irb/commit/52b79806ea
Diffstat (limited to 'test/irb/helper.rb')
-rw-r--r--test/irb/helper.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/irb/helper.rb b/test/irb/helper.rb
index e4ce7bff08..f4f969e889 100644
--- a/test/irb/helper.rb
+++ b/test/irb/helper.rb
@@ -57,11 +57,11 @@ module TestIRB
end
def without_rdoc(&block)
- ::Kernel.send(:alias_method, :old_require, :require)
+ ::Kernel.send(:alias_method, :irb_original_require, :require)
::Kernel.define_method(:require) do |name|
raise LoadError, "cannot load such file -- rdoc (test)" if name.match?("rdoc") || name.match?(/^rdoc\/.*/)
- ::Kernel.send(:old_require, name)
+ ::Kernel.send(:irb_original_require, name)
end
yield
@@ -70,7 +70,10 @@ module TestIRB
require_relative "../lib/envutil"
rescue LoadError # ruby/ruby defines EnvUtil differently
end
- EnvUtil.suppress_warning { ::Kernel.send(:alias_method, :require, :old_require) }
+ EnvUtil.suppress_warning {
+ ::Kernel.send(:alias_method, :require, :irb_original_require)
+ ::Kernel.undef_method :irb_original_require
+ }
end
end
end