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 failures when the build directory name contains + #6750

Merged
merged 2 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/rubygems/test_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,8 @@ def test_self_try_activate_missing_dep
Gem.try_activate "a_file"
end

assert_match(/Could not find 'b' /, e.message)
assert_match(/at: #{a.spec_file}/, e.message)
assert_include(e.message, "Could not find 'b' ")
assert_include(e.message, "at: #{a.spec_file}")
end

def test_self_try_activate_missing_prerelease
Expand Down
8 changes: 4 additions & 4 deletions test/rubygems/test_gem_command_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_process_args_with_c_flag_without_path
end
end

assert_match(/install isn't a directory./i, @ui.error)
assert_match(/install isn't a directory\./i, @ui.error)
end

def test_process_args_with_c_flag_path_not_found
Expand All @@ -164,7 +164,7 @@ def test_process_args_with_c_flag_path_not_found
end
end

assert_match(/#{custom_start_point} isn't a directory./i, @ui.error)
assert_match(/#{Regexp.quote(custom_start_point)} isn't a directory\./i, @ui.error)
end

def test_process_args_bad_arg
Expand Down Expand Up @@ -368,7 +368,7 @@ def execute
end

assert_equal "pew pew!\n", @ui.output
assert_match(/WARNING: foo command is deprecated. It will be removed in Rubygems [0-9]+/, @ui.error)
assert_match(/WARNING: foo command is deprecated\. It will be removed in Rubygems [0-9]+/, @ui.error)
ensure
Gem::Commands.send(:remove_const, :FooCommand)
end
Expand All @@ -393,7 +393,7 @@ def execute
end

assert_equal "pew pew!\n", @ui.output
assert_match(/WARNING: foo command is deprecated. It will be removed in Rubygems 9.9.9/, @ui.error)
assert_match(/WARNING: foo command is deprecated\. It will be removed in Rubygems 9\.9\.9/, @ui.error)
ensure
Gem::Commands.send(:remove_const, :FooCommand)
end
Expand Down
3 changes: 2 additions & 1 deletion test/rubygems/test_gem_commands_cert_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,9 @@ def test_execute_re_sign

expected_path = File.join(gem_path, "#{File.basename(tmp_expired_cert_file)}.expired")

assert_include(@ui.output, "INFO: Your certificate #{tmp_expired_cert_file} has been re-signed\n")
assert_match(
/INFO: Your certificate #{tmp_expired_cert_file} has been re-signed\nINFO: Your expired certificate will be located at: #{expected_path}\.[0-9]+/,
/INFO: Your expired certificate will be located at: #{Regexp.quote(expected_path)}\.[0-9]+/,
@ui.output
)
assert_equal "", @ui.error
Expand Down
12 changes: 6 additions & 6 deletions test/rubygems/test_gem_commands_info_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ def test_execute
@cmd.execute
end

assert_match %r{#{@gem.name} \(#{@gem.version}\)\n}, @ui.output
assert_match(/Authors: #{@gem.authors.join(', ')}\n/, @ui.output)
assert_match(/Homepage: #{@gem.homepage}\n/, @ui.output)
assert_match(/License: #{@gem.license}\n/, @ui.output)
assert_match(/Installed at: #{@gem.base_dir}\n/, @ui.output)
assert_match(/#{@gem.summary}\n/, @ui.output)
assert_include(@ui.output, "#{@gem.name} (#{@gem.version})\n")
assert_include(@ui.output, "Authors: #{@gem.authors.join(", ")}\n")
assert_include(@ui.output, "Homepage: #{@gem.homepage}\n")
assert_include(@ui.output, "License: #{@gem.license}\n")
assert_include(@ui.output, "Installed at: #{@gem.base_dir}\n")
assert_include(@ui.output, "#{@gem.summary}\n")
assert_match "", @ui.error
end

Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_ext_ext_conf_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_class_build
assert_same result, output

assert_match(/^current directory:/, output[0])
assert_match(/^#{Gem.ruby}.* extconf.rb/, output[1])
assert_match(/^#{Regexp.quote(Gem.ruby)}.* extconf.rb/, output[1])
assert_equal "creating Makefile\n", output[2]
assert_match(/^current directory:/, output[3])
assert_contains_make_command "clean", output[4]
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_class_build_extconf_fail

assert_equal "extconf failed, exit code 1", error.message

assert_match(/^#{Gem.ruby}.* extconf.rb/, output[1])
assert_match(/^#{Regexp.quote(Gem.ruby)}.* extconf.rb/, output[1])
assert_match(File.join(@dest_path, "mkmf.log"), output[4])
assert_includes(output, "To see why this extension failed to compile, please check the mkmf.log which can be found here:\n")

Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ def test_generate_bin_uses_default_shebang
installer.generate_bin

default_shebang = Gem.ruby
shebang_line = File.open("#{@gemhome}/bin/executable") {|f| f.readlines.first }
shebang_line = File.open("#{@gemhome}/bin/executable", &:gets)
assert_match(/\A#!/, shebang_line)
assert_match(/#{default_shebang}/, shebang_line)
assert_include(shebang_line, default_shebang)
end
end

Expand Down
10 changes: 8 additions & 2 deletions test/rubygems/test_gem_remote_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def test_download_cached
end

def test_download_local
omit "doesn't work if tempdir has +" if @tempdir.include?("+")
FileUtils.mv @a1_gem, @tempdir
local_path = File.join @tempdir, @a1.file_name
inst = nil
Expand All @@ -323,6 +324,7 @@ def test_download_local
end

def test_download_local_space
omit "doesn't work if tempdir has +" if @tempdir.include?("+")
space_path = File.join @tempdir, "space path"
FileUtils.mkdir space_path
FileUtils.mv @a1_gem, space_path
Expand Down Expand Up @@ -356,6 +358,7 @@ def test_download_install_dir

unless Gem.win_platform? || Process.uid.zero? # File.chmod doesn't work
def test_download_local_read_only
omit "doesn't work if tempdir has +" if @tempdir.include?("+")
FileUtils.mv @a1_gem, @tempdir
local_path = File.join @tempdir, @a1.file_name
inst = nil
Expand All @@ -374,8 +377,10 @@ def test_download_local_read_only
assert_equal(File.join(@tempdir, @a1.file_name),
inst.download(@a1, local_path))
ensure
FileUtils.chmod 0o755, File.join(Gem.user_dir, "cache")
FileUtils.chmod 0o755, @a1.cache_dir
if local_path
FileUtils.chmod 0o755, File.join(Gem.user_dir, "cache")
FileUtils.chmod 0o755, @a1.cache_dir
end
end

def test_download_read_only
Expand Down Expand Up @@ -418,6 +423,7 @@ def test_download_platform_legacy
end

def test_download_same_file
omit "doesn't work if tempdir has +" if @tempdir.include?("+")
FileUtils.mv @a1_gem, @tempdir
local_path = File.join @tempdir, @a1.file_name
inst = nil
Expand Down