summaryrefslogtreecommitdiff
path: root/test/fiddle/test_cparser.rb
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-17 09:51:23 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-17 09:51:23 +0000
commit1aaeeb326e754c5c5db83fbf35f780f729a9dfed (patch)
tree965d2c17a5c7d113e86d148c62404744f82dec3b /test/fiddle/test_cparser.rb
parent131dc83145fb72da00af94490e630b0339513fb2 (diff)
long long is a C99ism
so SIZEOF_LONG_LONG is not always available. We have to check its defined?-ness before using. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fiddle/test_cparser.rb')
-rw-r--r--test/fiddle/test_cparser.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/fiddle/test_cparser.rb b/test/fiddle/test_cparser.rb
index c053706e13..5d9ac3c815 100644
--- a/test/fiddle/test_cparser.rb
+++ b/test/fiddle/test_cparser.rb
@@ -127,10 +127,13 @@ module Fiddle
'short', 'unsigned short',
'int', 'unsigned int',
'long', 'unsigned long',
+ defined?(TYPE_LONG_LONG) && \
+ [
'long long', 'unsigned long long',
+ ],
'float', 'double',
'const char*', 'void*',
- ]
+ ].flatten.compact
func, ret, args = parse_signature("void func(#{types.join(',')})")
assert_equal 'func', func
assert_equal TYPE_VOID, ret
@@ -139,10 +142,13 @@ module Fiddle
TYPE_SHORT, -TYPE_SHORT,
TYPE_INT, -TYPE_INT,
TYPE_LONG, -TYPE_LONG,
+ defined?(TYPE_LONG_LONG) && \
+ [
TYPE_LONG_LONG, -TYPE_LONG_LONG,
+ ],
TYPE_FLOAT, TYPE_DOUBLE,
TYPE_VOIDP, TYPE_VOIDP,
- ], args
+ ].flatten.compact, args
end
def test_signature_single_variable