mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* ext/fiddle/lib/fiddle/cparser.rb: r49110 brake Fiddle::Import with
type_alias * test/fiddle/test_cparser.rb: added type_alias test for parse_ctype and parse_struct_signature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
68f7424bde
commit
1ba6e8868c
3 changed files with 24 additions and 0 deletions
|
@ -59,6 +59,14 @@ module Fiddle
|
|||
assert_equal(TYPE_UINTPTR_T, parse_ctype("uintptr_t"))
|
||||
end
|
||||
|
||||
def test_undefined_ctype
|
||||
assert_raises(DLError) { parse_ctype('DWORD') }
|
||||
end
|
||||
|
||||
def test_undefined_ctype_with_type_alias
|
||||
assert_equal(-TYPE_LONG, parse_ctype('DWORD', {"DWORD" => "unsigned long"}))
|
||||
end
|
||||
|
||||
def test_struct_basic
|
||||
assert_equal [[TYPE_INT, TYPE_CHAR], ['i', 'c']], parse_struct_signature(['int i', 'char c'])
|
||||
end
|
||||
|
@ -83,6 +91,14 @@ module Fiddle
|
|||
assert_equal [[TYPE_INT,TYPE_VOIDP,TYPE_VOIDP], ['x', 'cb', 'name']], parse_struct_signature('int x; void (*cb)(); const char* name')
|
||||
end
|
||||
|
||||
def test_struct_undefined
|
||||
assert_raises(DLError) { parse_struct_signature(['int i', 'DWORD cb']) }
|
||||
end
|
||||
|
||||
def test_struct_undefined_with_type_alias
|
||||
assert_equal [[TYPE_INT,-TYPE_LONG], ['i', 'cb']], parse_struct_signature(['int i', 'DWORD cb'], {"DWORD" => "unsigned long"})
|
||||
end
|
||||
|
||||
def test_signature_basic
|
||||
func, ret, args = parse_signature('void func()')
|
||||
assert_equal 'func', func
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue