[前][次][番号順一覧][スレッド一覧]

ruby-changes:27320

From: nobu <ko1@a...>
Date: Fri, 22 Feb 2013 11:41:47 +0900 (JST)
Subject: [ruby-changes:27320] nobu:r39372 (trunk): test_rbconfig.rb: honor configuration options

nobu	2013-02-22 11:36:48 +0900 (Fri, 22 Feb 2013)

  New Revision: 39372

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39372

  Log:
    test_rbconfig.rb: honor configuration options
    
    * test/test_rbconfig.rb (TestRbConfig): skip user defined values by
      configuration options.  [Bug #7902]

  Modified files:
    trunk/ChangeLog
    trunk/test/test_rbconfig.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39371)
+++ ChangeLog	(revision 39372)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Feb 22 11:36:45 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/test_rbconfig.rb (TestRbConfig): skip user defined values by
+	  configuration options.  [Bug #7902]
+
 Fri Feb 22 11:33:42 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/mkmf.rb (MakeMakefile#init_mkmf): adjust default library path
Index: test/test_rbconfig.rb
===================================================================
--- test/test_rbconfig.rb	(revision 39371)
+++ test/test_rbconfig.rb	(revision 39372)
@@ -1,10 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/test/test_rbconfig.rb#L1
 require 'test/unit'
 require 'rbconfig'
+require 'shellwords'
 
 class TestRbConfig < Test::Unit::TestCase
+  @@with_config = {}
+
+  Shellwords::shellwords(CONFIG["configure_args"]).grep(/\A--with-([^=]*)=(.*)/) do
+    @@with_config[$1.tr('_', '-')] = $2
+  end
+
   def test_sitedirs
     RbConfig::MAKEFILE_CONFIG.each do |key, val|
       next unless /\Asite(?!arch)/ =~ key
+      next if @@with_config[key]
       assert_match(/(?:\$\(|\/)site/, val, key)
     end
   end
@@ -12,6 +20,7 @@ class TestRbConfig < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/test_rbconfig.rb#L20
   def test_vendordirs
     RbConfig::MAKEFILE_CONFIG.each do |key, val|
       next unless /\Avendor(?!arch)/ =~ key
+      next if @@with_config[key]
       assert_match(/(?:\$\(|\/)vendor/, val, key)
     end
   end
@@ -19,6 +28,7 @@ class TestRbConfig < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/test_rbconfig.rb#L28
   def test_archdirs
     RbConfig::MAKEFILE_CONFIG.each do |key, val|
       next unless /\A(?!site|vendor|archdir\z).*arch.*dir\z/ =~ key
+      next if @@with_config[key]
       assert_match(/\$\(arch|\$\(rubyarchprefix\)/, val, key)
     end
   end
@@ -27,6 +37,7 @@ class TestRbConfig < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/test_rbconfig.rb#L37
     bug7823 = '[ruby-dev:46964] [Bug #7823]'
     RbConfig::MAKEFILE_CONFIG.each do |key, val|
       next unless /\Asite.*arch.*dir\z/ =~ key
+      next if @@with_config[key]
       assert_match(/\$\(sitearch|\$\(rubysitearchprefix\)/, val, "#{key} #{bug7823}")
     end
   end
@@ -35,6 +46,7 @@ class TestRbConfig < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/test_rbconfig.rb#L46
     bug7823 = '[ruby-dev:46964] [Bug #7823]'
     RbConfig::MAKEFILE_CONFIG.each do |key, val|
       next unless /\Avendor.*arch.*dir\z/ =~ key
+      next if @@with_config[key]
       assert_match(/\$\(sitearch|\$\(rubysitearchprefix\)/, val, "#{key} #{bug7823}")
     end
   end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]