diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-03 10:53:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-03 10:53:53 +0000 |
commit | e33b7f338158ec83f4817bbb4c91248ed2b13b2d (patch) | |
tree | c113af8b43405c93db55cab487a6156555c269bc /test/mkmf | |
parent | 7031b99bca22bd8fa1d078b182226f59007250f0 (diff) | |
download | ruby-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.rb | 26 |
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 |