diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-25 15:42:22 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-25 15:42:22 +0000 |
commit | 589da706be0b7abcbcf54e6f8c979c94ea174b09 (patch) | |
tree | 43da9a5cb9c4c690a2f02209979dd7f739c8980c /test/rubygems | |
parent | 7567977adc82ec528f4f0e5c650a940304e84b34 (diff) |
* lib/rubygems: Update to RubyGems 2.0.6. [ruby-core:56160]
[Backport #8682]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/test_gem_commands_query_command.rb | 28 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_search_command.rb | 17 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_builder.rb | 58 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_ext_conf_builder.rb | 5 |
4 files changed, 107 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb index b79d13d270..a7e5e01f09 100644 --- a/test/rubygems/test_gem_commands_query_command.rb +++ b/test/rubygems/test_gem_commands_query_command.rb @@ -195,6 +195,34 @@ pl (1) assert_equal '', @ui.error end + def test_execute_installed_inverse + @cmd.handle_options %w[-n a --no-installed] + + e = assert_raises Gem::MockGemUi::TermError do + use_ui @ui do + @cmd.execute + end + end + + assert_equal "false\n", @ui.output + assert_equal '', @ui.error + + assert_equal 1, e.exit_code + end + + def test_execute_installed_inverse_not_installed + @cmd.handle_options %w[-n not_installed --no-installed] + + assert_raises Gem::MockGemUi::SystemExitException do + use_ui @ui do + @cmd.execute + end + end + + assert_equal "true\n", @ui.output + assert_equal '', @ui.error + end + def test_execute_installed_no_name @cmd.handle_options %w[--installed] diff --git a/test/rubygems/test_gem_commands_search_command.rb b/test/rubygems/test_gem_commands_search_command.rb index e69de29bb2..fb8debc245 100644 --- a/test/rubygems/test_gem_commands_search_command.rb +++ b/test/rubygems/test_gem_commands_search_command.rb @@ -0,0 +1,17 @@ +require 'rubygems/test_case' +require 'rubygems/commands/search_command' + +class TestGemCommandsSearchCommand < Gem::TestCase + + def setup + super + + @cmd = Gem::Commands::SearchCommand.new + end + + def test_initialize + assert_equal :remote, @cmd.defaults[:domain] + end + +end + diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb new file mode 100644 index 0000000000..14a77b8db3 --- /dev/null +++ b/test/rubygems/test_gem_ext_builder.rb @@ -0,0 +1,58 @@ +require 'rubygems/test_case' +require 'rubygems/ext' + +class TestGemExtBuilder < Gem::TestCase + + def setup + super + + @ext = File.join @tempdir, 'ext' + @dest_path = File.join @tempdir, 'prefix' + + FileUtils.mkdir_p @ext + FileUtils.mkdir_p @dest_path + + @orig_DESTDIR = ENV['DESTDIR'] + end + + def teardown + ENV['DESTDIR'] = @orig_DESTDIR + + super + end + + def test_class_make + ENV['DESTDIR'] = 'destination' + results = [] + + Dir.chdir @ext do + open 'Makefile', 'w' do |io| + io.puts <<-MAKEFILE +all: +\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}" + +install: +\t@#{Gem.ruby} -e "puts %Q{install: \#{ENV['DESTDIR']}}" + MAKEFILE + end + + Gem::Ext::Builder.make @dest_path, results + end + + results = results.join "\n" + + + if RUBY_VERSION > '2.0' then + assert_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results + assert_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results + else + refute_match %r%"DESTDIR=#{ENV['DESTDIR']}"$%, results + refute_match %r%"DESTDIR=#{ENV['DESTDIR']}" install$%, results + end + + assert_match %r%^all: destination$%, results + assert_match %r%^install: destination$%, results + end + +end + diff --git a/test/rubygems/test_gem_ext_ext_conf_builder.rb b/test/rubygems/test_gem_ext_ext_conf_builder.rb index ec4dd3d6ce..33398ac6f3 100644 --- a/test/rubygems/test_gem_ext_ext_conf_builder.rb +++ b/test/rubygems/test_gem_ext_ext_conf_builder.rb @@ -27,7 +27,10 @@ class TestGemExtExtConfBuilder < Gem::TestCase output = [] Dir.chdir @ext do - Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output + result = + Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output + + assert_same result, output end assert_match(/^#{Gem.ruby} extconf.rb/, output[0]) |