summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-10-12 22:55:41 +0900
committergit <svn-admin@ruby-lang.org>2023-10-12 13:55:47 +0000
commitcf21c72cdbe9a9481925c978eccd211f7e9536ef (patch)
treea33cd373e143463fcc610b97a970b12c0226d77e /test
parente029375a7dc59897931fd3cfe334ffd4864f5049 (diff)
[ruby/irb] Fix test runner exit bug
(https://github.com/ruby/irb/pull/728) * Remove useless test setup and teardown that sets MAIN_CONTEXT to nil * Avoid adding command methods to main object in test https://github.com/ruby/irb/commit/f204829a08
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_completion.rb9
-rw-r--r--test/irb/test_irb.rb6
2 files changed, 5 insertions, 10 deletions
diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb
index 2ef8938269..8402889400 100644
--- a/test/irb/test_completion.rb
+++ b/test/irb/test_completion.rb
@@ -6,15 +6,6 @@ require_relative "helper"
module TestIRB
class CompletionTest < TestCase
- def setup
- # make sure require completion candidates are not cached
- IRB::BaseCompletor.class_variable_set(:@@files_from_load_path, nil)
- end
-
- def teardown
- IRB.conf[:MAIN_CONTEXT] = nil
- end
-
def completion_candidates(target, bind)
IRB::RegexpCompletor.new.completion_candidates('', target, '', bind: bind)
end
diff --git a/test/irb/test_irb.rb b/test/irb/test_irb.rb
index e89f2a1c70..b32e857c1e 100644
--- a/test/irb/test_irb.rb
+++ b/test/irb/test_irb.rb
@@ -733,9 +733,13 @@ module TestIRB
private
+ def build_binding
+ Object.new.instance_eval { binding }
+ end
+
def build_irb
IRB.init_config(nil)
- workspace = IRB::WorkSpace.new(TOPLEVEL_BINDING.dup)
+ workspace = IRB::WorkSpace.new(build_binding)
IRB.conf[:VERBOSE] = false
IRB::Irb.new(workspace, TestInputMethod.new)