blob: 2e277d302bbdff34105f6b8b8bc3a95a48b65408 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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
$extout_prefix = "$(extout)$(target_prefix)/"
class TestMkmf < Test::Unit::TestCase
def setup
@tmpdir = Dir.mktmpdir
@mkmfobj = Object.new
end
def mkmf(*args, &block)
@mkmfobj.instance_eval(*args, &block)
end
def test_sizeof
Dir.chdir(@tmpdir) do
open("confdefs.h", "w") {|f|
f.puts "typedef struct {char x;} test1_t;"
}
mkmf {check_sizeof("test1_t", "confdefs.h")} rescue puts File.read("mkmf.log")
end
end
end
|