diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-30 23:41:07 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-30 23:41:07 +0000 |
commit | 0381ab07694668c4420307a6d8e9f0265ed9c56d (patch) | |
tree | 55f43cec08aa17fd93ff3d931a3b61ea680e66bb /test/dl | |
parent | f1cb6ea08f8fc897d914fc7c2c23701471657e4f (diff) | |
download | ruby-0381ab07694668c4420307a6d8e9f0265ed9c56d.tar.gz |
* ext/dl/lib/dl/struct.rb (DL::CUnionEntity#set_ctypes): Refactored
#set_types to reuse DL::CUnionEntity::size
* test/dl/test_c_union_entity.rb: Added test
Reviewed by Aaron Paterson
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/dl')
-rw-r--r-- | test/dl/test_c_union_entity.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/dl/test_c_union_entity.rb b/test/dl/test_c_union_entity.rb index 8c72a664eb..128ca4cd5c 100644 --- a/test/dl/test_c_union_entity.rb +++ b/test/dl/test_c_union_entity.rb @@ -14,5 +14,17 @@ class DL::TestCUnionEntity < DL::TestBase assert_equal DL::SIZEOF_CHAR * 20, size end + + def test_set_ctypes + union = DL::CUnionEntity.malloc [DL::TYPE_INT, DL::TYPE_LONG] + union.assign_names %w[int long] + + # this test is roundabout because the stored ctypes are not accessible + union['long'] = 1 + assert_equal 1, union['long'] + + union['int'] = 1 + assert_equal 1, union['int'] + end end |