summaryrefslogtreecommitdiff
path: root/test/mkmf/test_sizeof.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-06 04:00:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-06 04:00:38 +0000
commitc6ada1e7e044d584e30359c8783a5bf9eb019d60 (patch)
tree2bec70a1eb44e3273292739fef26c4c5b0af5e5e /test/mkmf/test_sizeof.rb
parentd04b691b96fa1c4c0c55a30e711309f7d5301042 (diff)
* 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
Diffstat (limited to 'test/mkmf/test_sizeof.rb')
-rw-r--r--test/mkmf/test_sizeof.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/mkmf/test_sizeof.rb b/test/mkmf/test_sizeof.rb
new file mode 100644
index 0000000000..2e277d302b
--- /dev/null
+++ b/test/mkmf/test_sizeof.rb
@@ -0,0 +1,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