summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2023-11-09 22:15:22 +0900
committergit <svn-admin@ruby-lang.org>2023-11-09 13:15:26 +0000
commitc4efd170616c3ee82a07fda04f878120f1a97e98 (patch)
treecf900363fc04292a2b31425a0ffa68ed50647f65 /test
parentae1fad4cd7d88b464aaebad3d5769d27ba675183 (diff)
[ruby/irb] Add command line option to select which completor to use
(https://github.com/ruby/irb/pull/754) * Add command line option to select which completor to use * Add test for completor argv https://github.com/ruby/irb/commit/1dec2708c9
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_init.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/irb/test_init.rb b/test/irb/test_init.rb
index 9f3f2a1098..e330cc5e84 100644
--- a/test/irb/test_init.rb
+++ b/test/irb/test_init.rb
@@ -120,6 +120,22 @@ module TestIRB
IRB.conf[:USE_AUTOCOMPLETE] = orig_use_autocomplete_conf
end
+ def test_completor_setup_with_argv
+ orig_completor_conf = IRB.conf[:COMPLETOR]
+
+ # Default is :regexp
+ IRB.setup(__FILE__, argv: [])
+ assert_equal :regexp, IRB.conf[:COMPLETOR]
+
+ IRB.setup(__FILE__, argv: ['--type-completor'])
+ assert_equal :type, IRB.conf[:COMPLETOR]
+
+ IRB.setup(__FILE__, argv: ['--regexp-completor'])
+ assert_equal :regexp, IRB.conf[:COMPLETOR]
+ ensure
+ IRB.conf[:COMPLETOR] = orig_completor_conf
+ end
+
def test_noscript
argv = %w[--noscript -- -f]
IRB.setup(eval("__FILE__"), argv: argv)