summaryrefslogtreecommitdiff
path: root/test/irb/test_completion.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/irb/test_completion.rb')
-rw-r--r--test/irb/test_completion.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb
index 52bbc7b2cc..a765bbf3a5 100644
--- a/test/irb/test_completion.rb
+++ b/test/irb/test_completion.rb
@@ -25,5 +25,27 @@ module TestIRB
assert_include(IRB::InputCompletor.retrieve_completion_data("1r.positi", bind: binding), "1r.positive?")
assert_empty(IRB::InputCompletor.retrieve_completion_data("1i.positi", bind: binding))
end
+
+ def test_complete_symbol
+ _ = :aiueo
+ assert_include(IRB::InputCompletor.retrieve_completion_data(":a", bind: binding), ":aiueo")
+ assert_empty(IRB::InputCompletor.retrieve_completion_data(":irb_unknown_symbol_abcdefg", bind: binding))
+ end
+
+ def test_complete_symbol_failure
+ assert_nil(IRB::InputCompletor::PerfectMatchedProc.(":aiueo", bind: binding))
+ end
+
+ def test_complete_reserved_words
+ candidates = IRB::InputCompletor.retrieve_completion_data("de", bind: binding)
+ %w[def defined?].each do |word|
+ assert_include candidates, word
+ end
+
+ candidates = IRB::InputCompletor.retrieve_completion_data("__", bind: binding)
+ %w[__ENCODING__ __LINE__ __FILE__].each do |word|
+ assert_include candidates, word
+ end
+ end
end
end