2009-08-06 00:14:50 -04:00
|
|
|
require 'test/unit'
|
|
|
|
require 'mkmf'
|
|
|
|
require 'tmpdir'
|
|
|
|
|
|
|
|
$extout = '$(topdir)/'+RbConfig::CONFIG["EXTOUT"]
|
|
|
|
RbConfig::CONFIG['topdir'] = CONFIG['topdir'] = File.expand_path(CONFIG['topdir'])
|
|
|
|
RbConfig::CONFIG["extout"] = CONFIG["extout"] = $extout
|
2009-11-25 21:42:24 -05:00
|
|
|
$INCFLAGS << " -I."
|
2009-08-06 00:14:50 -04:00
|
|
|
$extout_prefix = "$(extout)$(target_prefix)/"
|
|
|
|
|
2009-08-06 00:30:15 -04:00
|
|
|
class TestMkmf < Test::Unit::TestCase
|
2009-08-06 00:14:50 -04:00
|
|
|
def setup
|
|
|
|
@tmpdir = Dir.mktmpdir
|
|
|
|
@curdir = Dir.pwd
|
|
|
|
@mkmfobj = Object.new
|
|
|
|
Dir.chdir(@tmpdir)
|
2009-08-06 00:30:15 -04:00
|
|
|
class << (@output = "")
|
|
|
|
def flush; end
|
|
|
|
def reopen(*) end
|
|
|
|
alias write <<
|
|
|
|
end
|
|
|
|
$stdout = @output
|
2009-08-06 00:14:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
2009-08-06 00:30:15 -04:00
|
|
|
$stdout = STDOUT
|
2009-08-06 00:14:50 -04:00
|
|
|
Dir.chdir(@curdir)
|
|
|
|
FileUtils.rm_rf(@tmpdir)
|
|
|
|
end
|
|
|
|
|
|
|
|
def mkmf(*args, &block)
|
|
|
|
@mkmfobj.instance_eval(*args, &block)
|
|
|
|
end
|
|
|
|
end
|