1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/mkmf/test_sizeof.rb
nobu c6ada1e7e0 * lib/mkmf.rb (check_sizeof): added optional compiler option
argument.  [ruby-core:24785]

* lib/mkmf.rb (create_makefile): suppressed shadowing outer local
  variable warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-06 04:00:38 +00:00

27 lines
714 B
Ruby

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