summaryrefslogtreecommitdiff
path: root/test/irb/helper.rb
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2022-10-26 11:12:32 -0400
committergit <[email protected]>2022-10-26 15:13:44 +0000
commit73a0223f952ef40d4986dde65eadb8f0b59521f2 (patch)
tree38be9696501db2a372d959b15757cbdb82453c31 /test/irb/helper.rb
parentcb95d834cc19a45a84d8d2c6d0f25d0c44e0d813 (diff)
[ruby/irb] Rename test_helper.rb to helper.rb
The name test_helper.rb conflicts with the test_helper.rb in JSON, causing build failures. This commit renames test_helper.rb to helper.rb. https://github.com/ruby/irb/commit/b6a92bf6b3 Co-Authored-By: Stan Lo <[email protected]>
Diffstat (limited to 'test/irb/helper.rb')
-rw-r--r--test/irb/helper.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/irb/helper.rb b/test/irb/helper.rb
new file mode 100644
index 0000000000..19c39a4a59
--- /dev/null
+++ b/test/irb/helper.rb
@@ -0,0 +1,16 @@
+module IRB
+ module TestHelper
+ def self.without_rdoc(&block)
+ ::Kernel.send(:alias_method, :old_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)
+ end
+
+ yield
+ ensure
+ EnvUtil.suppress_warning { ::Kernel.send(:alias_method, :require, :old_require) }
+ end
+ end
+end