Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix completion tests #401

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions test/irb/test_completion.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: false
require "test/unit"
require "pathname"
require "irb"

module TestIRB
Expand Down Expand Up @@ -96,7 +97,7 @@ def test_complete_require_with_pathname_in_load_path
$LOAD_PATH << test_path

candidates = IRB::InputCompletor::CompletionProc.("'foo", "require ", "")
assert_equal ["'foo"], candidates
assert_include candidates, "'foo"
ensure
$LOAD_PATH.pop if test_path
FileUtils.remove_entry(temp_dir) if temp_dir
Expand All @@ -110,7 +111,7 @@ def test_complete_require_with_string_convertable_in_load_path
$LOAD_PATH << object

candidates = IRB::InputCompletor::CompletionProc.("'foo", "require ", "")
assert_equal ["'foo"], candidates
assert_include candidates, "'foo"
ensure
$LOAD_PATH.pop if object
FileUtils.remove_entry(temp_dir) if temp_dir
Expand All @@ -121,7 +122,9 @@ def test_complete_require_with_malformed_object_in_load_path
def object.to_s; raise; end
$LOAD_PATH << object

assert_empty IRB::InputCompletor::CompletionProc.("'foo", "require ", "")
assert_nothing_raised do
IRB::InputCompletor::CompletionProc.("'foo", "require ", "")
end
ensure
$LOAD_PATH.pop if object
end
Expand Down