diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
commit | e798ccbacf489a3af2201ae30058ff0ae7f79045 (patch) | |
tree | 4147a7834eb88323057fd2120a2ddc96c1eb32ab /test/rubygems/test_gem_ext_ext_conf_builder.rb | |
parent | d26fb035cae8d351dc238376722c980230dc5fbd (diff) | |
download | ruby-e798ccbacf489a3af2201ae30058ff0ae7f79045.tar.gz |
Import rubygems 1.5.0 (release candidate)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_ext_ext_conf_builder.rb')
-rw-r--r-- | test/rubygems/test_gem_ext_ext_conf_builder.rb | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/test/rubygems/test_gem_ext_ext_conf_builder.rb b/test/rubygems/test_gem_ext_ext_conf_builder.rb index d9483df2de..4b03858a2a 100644 --- a/test/rubygems/test_gem_ext_ext_conf_builder.rb +++ b/test/rubygems/test_gem_ext_ext_conf_builder.rb @@ -1,4 +1,10 @@ -require_relative 'gemutilities' +###################################################################### +# This file is imported from the rubygems project. +# DO NOT make modifications in this repo. They _will_ be reverted! +# File a patch instead and assign it to Ryan Davis or Eric Hodel. +###################################################################### + +require "test/rubygems/gemutilities" require 'rubygems/ext' class TestGemExtExtConfBuilder < RubyGemTestCase @@ -28,19 +34,60 @@ class TestGemExtExtConfBuilder < RubyGemTestCase Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output end - expected = [ - "ruby extconf.rb", - "creating Makefile\n", - "make", - "make: Nothing to be done for `all'.\n", - "make install", - "make: Nothing to be done for `install'.\n" - ] - assert_match(/^#{Gem.ruby} extconf.rb/, output[0]) assert_equal "creating Makefile\n", output[1] + case RUBY_PLATFORM + when /mswin/ then + assert_equal "nmake", output[2] + assert_equal "nmake install", output[4] + else + assert_equal "make", output[2] + assert_equal "make install", output[4] + end + end + + def test_class_build_rbconfig_make_prog + configure_args = RbConfig::CONFIG['configure_args'] + + File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf| + extconf.puts "require 'mkmf'\ncreate_makefile 'foo'" + end + + output = [] + + Dir.chdir @ext do + Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output + end + + assert_equal "creating Makefile\n", output[1] assert_equal make_command, output[2] - assert_equal make_command + " install", output[4] + assert_equal "#{make_command} install", output[4] + ensure + RbConfig::CONFIG['configure_args'] = configure_args + end + + def test_class_build_env_make + configure_args, env_make = RbConfig::CONFIG['configure_args'], ENV.delete('make') + RbConfig::CONFIG['configure_args'] = '' + ENV['make'] = 'anothermake' + + File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf| + extconf.puts "require 'mkmf'\ncreate_makefile 'foo'" + end + + output = [] + + assert_raises Gem::InstallError do + Dir.chdir @ext do + Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output + end + end + + assert_equal "creating Makefile\n", output[1] + assert_equal "anothermake", output[2] + ensure + RbConfig::CONFIG['configure_args'] = configure_args + ENV['make'] = env_make end def test_class_build_extconf_fail |