[rubygems/rubygems] Clean up generated and copied files

> leaving the files after gem rebuild was intentional, for local
> inspection, but the test suite should be made to clean up after
> itself independently of that.
https://github.com/rubygems/rubygems/pull/4913#issuecomment-2081710691

https://github.com/rubygems/rubygems/commit/185a2091fb
This commit is contained in:
Nobuyoshi Nakada 2024-04-20 19:56:58 +09:00 committed by git
parent 2aed14d65b
commit 9d69619623

View File

@ -105,7 +105,7 @@ class TestGemCommandsRebuildCommand < Gem::TestCase
assert_equal old_spec.name, new_spec.name
assert_equal old_spec.summary, new_spec.summary
reproduced
[reproduced, original]
end
def test_build_is_reproducible
@ -134,12 +134,21 @@ class TestGemCommandsRebuildCommand < Gem::TestCase
# also testing that `gem rebuild` overrides the value.
ENV["SOURCE_DATE_EPOCH"] = Time.new(2007, 8, 9, 10, 11, 12).to_s
rebuild_gem_file = util_test_rebuild_gem(@gem, [@gem_name, @gem_version], original_gem_file, gemspec_file, timestamp)
rebuild_gem_file, saved_gem_file =
util_test_rebuild_gem(@gem, [@gem_name, @gem_version], original_gem_file, gemspec_file, timestamp)
rebuild_contents = File.read(rebuild_gem_file)
assert_equal build_contents, rebuild_contents
ensure
ENV["SOURCE_DATE_EPOCH"] = epoch
if rebuild_gem_file
File.unlink(rebuild_gem_file)
dir = File.dirname(rebuild_gem_file)
Dir.rmdir(dir)
File.unlink(saved_gem_file)
Dir.rmdir(File.dirname(saved_gem_file))
Dir.rmdir(File.dirname(dir))
end
end
end