diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-03-08 18:23:10 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-03-10 03:51:16 +0000 |
commit | 15739c66b713a695b0dfc1e4c1bf01b7d2a04426 (patch) | |
tree | def3b086287ae31d81d6274007e58cabe4ca58db /test/rubygems/test_gem_commands_pristine_command.rb | |
parent | 86d38b452005a9168eb2b5eaffd5fb3465313436 (diff) | |
download | ruby-15739c66b713a695b0dfc1e4c1bf01b7d2a04426.tar.gz |
[rubygems/rubygems] Added only missing extensions option into pristine command
https://github.com/rubygems/rubygems/commit/cfd0e615d7
Diffstat (limited to 'test/rubygems/test_gem_commands_pristine_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_pristine_command.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb index 5bf1d27eb9..db1583bcd3 100644 --- a/test/rubygems/test_gem_commands_pristine_command.rb +++ b/test/rubygems/test_gem_commands_pristine_command.rb @@ -202,6 +202,54 @@ class TestGemCommandsPristineCommand < Gem::TestCase assert_empty out, out.inspect end + def test_execute_extensions_only_missing_extensions + a = util_spec "a" do |s| + s.extensions << "ext/a/extconf.rb" + end + + ext_path = File.join @tempdir, "ext", "a", "extconf.rb" + write_file ext_path do |io| + io.write <<-'RUBY' + File.open "Makefile", "w" do |f| + f.puts "clean:\n\techo cleaned\n" + f.puts "all:\n\techo built\n" + f.puts "install:\n\techo installed\n" + end + RUBY + end + + b = util_spec "b" do |s| + s.extensions << "ext/b/extconf.rb" + end + + ext_path = File.join @tempdir, "ext", "b", "extconf.rb" + write_file ext_path do |io| + io.write <<-'RUBY' + File.open "Makefile", "w" do |f| + f.puts "clean:\n\techo cleaned\n" + f.puts "all:\n\techo built\n" + f.puts "install:\n\techo installed\n" + end + RUBY + end + + install_gem a + install_gem b + + # Remove the extension files for b + FileUtils.rm_rf b.gem_build_complete_path + + @cmd.options[:only_missing_extensions] = true + @cmd.options[:args] = [] + + use_ui @ui do + @cmd.execute + end + + refute_includes @ui.output, "Restored #{a.full_name}" + assert_includes @ui.output, "Restored #{b.full_name}" + end + def test_execute_no_extension a = util_spec "a" do |s| s.extensions << "ext/a/extconf.rb" |