aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-10-14 23:12:37 +0900
committergit <svn-admin@ruby-lang.org>2023-10-14 14:12:43 +0000
commit4e5c505bad2a2c6c62992a74b503d7213fbc2b93 (patch)
tree28de5385447614017948c3bd05c8887da301c50f /test
parent96cd73d78f8986db0aaab9368c2ffa6867613a37 (diff)
downloadruby-4e5c505bad2a2c6c62992a74b503d7213fbc2b93.tar.gz
[ruby/irb] Restore IRB::InputCompletor for compatibility
(https://github.com/ruby/irb/pull/730) https://github.com/ruby/irb/commit/77265efc5f
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_completion.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb
index 19a6a4740a..ed5b88d66e 100644
--- a/test/irb/test_completion.rb
+++ b/test/irb/test_completion.rb
@@ -265,4 +265,29 @@ module TestIRB
assert_include(doc_namespace("private_hoge", bind), "private_hoge")
end
end
+
+ class DeprecatedInputCompletorTest < TestCase
+ def setup
+ @verbose, $VERBOSE = $VERBOSE, nil
+ IRB.init_config(nil)
+ IRB.conf[:MAIN_CONTEXT] = IRB::Context.new(IRB::WorkSpace.new(binding))
+ end
+
+ def teardown
+ $VERBOSE = @verbose
+ end
+
+ def test_completion_proc
+ assert_include(IRB::InputCompletor::CompletionProc.call('1.ab'), '1.abs')
+ assert_include(IRB::InputCompletor::CompletionProc.call('1.ab', '', ''), '1.abs')
+ end
+
+ def test_retrieve_completion_data
+ assert_include(IRB::InputCompletor.retrieve_completion_data('1.ab'), '1.abs')
+ assert_equal(IRB::InputCompletor.retrieve_completion_data('1.abs', doc_namespace: true), 'Integer.abs')
+ bind = eval('a = 1; binding')
+ assert_include(IRB::InputCompletor.retrieve_completion_data('a.ab', bind: bind), 'a.abs')
+ assert_equal(IRB::InputCompletor.retrieve_completion_data('a.abs', bind: bind, doc_namespace: true), 'Integer.abs')
+ end
+ end
end