summaryrefslogtreecommitdiff
path: root/test/mkmf
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-03 10:53:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-03 10:53:53 +0000
commite33b7f338158ec83f4817bbb4c91248ed2b13b2d (patch)
treec113af8b43405c93db55cab487a6156555c269bc /test/mkmf
parent7031b99bca22bd8fa1d078b182226f59007250f0 (diff)
downloadruby-e33b7f338158ec83f4817bbb4c91248ed2b13b2d.tar.gz
* lib/mkmf.rb (convertible_int): detect convertible integer type.
port RUBY_REPLACE_INT from configure.in. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/mkmf')
-rw-r--r--test/mkmf/test_convertible.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/mkmf/test_convertible.rb b/test/mkmf/test_convertible.rb
new file mode 100644
index 0000000000..e8cc280eeb
--- /dev/null
+++ b/test/mkmf/test_convertible.rb
@@ -0,0 +1,26 @@
+require_relative 'base'
+
+class TestMkmf
+ class TestConvertible < TestMkmf
+ def test_typeof_builtin
+ ["", ["signed ", ""], "unsigned "].each do |signed, prefix|
+ %w[short int long].each do |type|
+ assert_equal((prefix || signed)+type,
+ mkmf {convertible_int(signed+type)})
+ end
+ end
+ end
+
+ def test_typeof_typedef
+ ["", ["signed ", ""], "unsigned "].each do |signed, prefix|
+ %w[short int long].each do |type|
+ open("confdefs.h", "w") {|f|
+ f.puts "typedef #{signed}#{type} test1_t;"
+ }
+ assert_equal((prefix || signed)+type,
+ mkmf {convertible_int("test1_t", "confdefs.h")})
+ end
+ end
+ end
+ end
+end