summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-03 13:44:30 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-03 13:44:30 +0000
commitab660694feb8128c8a1c5bdadea21acb5af89810 (patch)
treef196c62223729288518a84847a9d498e134de3cc /test
parenta1525108b87dac3032754f4152d37258f3ea4c0c (diff)
merge revision(s) 41777,41779: [Backport #8593]
* lib/mkmf.rb (have_framework): allow header file to check. [ruby-core:55745] [Bug #8593] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/mkmf/test_framework.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/mkmf/test_framework.rb b/test/mkmf/test_framework.rb
index 39171a0bb6..1b595aab7a 100644
--- a/test/mkmf/test_framework.rb
+++ b/test/mkmf/test_framework.rb
@@ -2,6 +2,24 @@ require_relative 'base'
class TestMkmf
class TestHaveFramework < TestMkmf
+ def create_framework(fw, hdrname = "#{fw}.h")
+ Dir.mktmpdir("frameworks") do |dir|
+ fwdir = "#{dir}/#{fw}.framework"
+ hdrdir = "#{fwdir}/Headers"
+ FileUtils.mkdir_p(hdrdir)
+ File.write("#{hdrdir}/#{hdrname}", "")
+ src = "#{fwdir}/main.c"
+ File.write(src, "void #{fw}(void) {}")
+ cmd = LINK_SO.dup
+ RbConfig.expand(cmd, RbConfig::CONFIG.merge("OBJS"=>src))
+ cmd.sub!("$@", "#{fwdir}/#{fw}")
+ cmd.sub!(/ -bundle /, ' -dynamiclib ')
+ assert(xsystem(cmd), MKMFLOG)
+ $INCFLAGS << " " << "-F#{dir}".quote
+ yield fw, hdrname
+ end
+ end
+
def test_core_foundation_framework
assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
end
@@ -10,5 +28,19 @@ class TestMkmf
assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
assert(have_framework("Cocoa"), mkmflog("try as Objective-C"))
end
+
+ def test_empty_framework
+ create_framework("MkmfTest") do |fw|
+ assert(have_framework(fw), MKMFLOG)
+ end
+ end
+
+ def test_different_name_header
+ bug8593 = '[ruby-core:55745] [Bug #8593]'
+ create_framework("MkmfTest", "test_mkmf.h") do |fw, hdrname|
+ assert(!have_framework(fw), MKMFLOG)
+ assert(have_framework([fw, hdrname]), MKMFLOG)
+ end
+ end
end
end if /darwin/ =~ RUBY_PLATFORM