summaryrefslogtreecommitdiff
path: root/test/fiddle/test_import.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-15 00:43:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-15 00:43:14 +0000
commit065b6d2b7ca234d9e45493e11a96d6d0c06bfc29 (patch)
tree1a0aa71c8b50cb14a881e017d816e5a3a9a63a28 /test/fiddle/test_import.rb
parent80f431990cbe1299546a095e2e1192e773f9839b (diff)
fiddle/import.rb: fix typo
* ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo, SIZEOF_LONG_LON. [Fix GH-714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/fiddle/test_import.rb')
-rw-r--r--test/fiddle/test_import.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/fiddle/test_import.rb b/test/fiddle/test_import.rb
index 62985cfcd3..d06477bfa5 100644
--- a/test/fiddle/test_import.rb
+++ b/test/fiddle/test_import.rb
@@ -65,6 +65,15 @@ module Fiddle
assert_equal(LIBC::MyStruct.size(), LIBC.sizeof(LIBC::MyStruct.malloc()))
end
+ Fiddle.constants.grep(/\ATYPE_(?!VOID\z)(.*)/) do
+ type = $&
+ size = Fiddle.const_get("SIZEOF_#{$1}")
+ name = $1.sub(/P\z/,"*").gsub(/_(?!T\z)/, " ").downcase
+ define_method("test_sizeof_#{name}") do
+ assert_equal(size, Fiddle::Importer.sizeof(name), type)
+ end
+ end
+
def test_unsigned_result()
d = (2 ** 31) + 1