From eb1691f636af4f5fcdff732189e28386fe540c74 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 21 Sep 2022 14:53:06 +0100 Subject: [PATCH] Fix completion tests --- test/irb/test_completion.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb index 4bc3fc778..a3349bc04 100644 --- a/test/irb/test_completion.rb +++ b/test/irb/test_completion.rb @@ -1,5 +1,6 @@ # frozen_string_literal: false require "test/unit" +require "pathname" require "irb" module TestIRB @@ -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 @@ -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 @@ -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