

def test_unnamed_struct():
    ffi = FFI(backend=FakeBackend())
    ffi.cdef('typedef struct { int x; } foo_t;\ntypedef struct { int y; } *bar_p;\n')
    assert ('typedef foo_t' in ffi._parser._declarations)
    assert ('typedef bar_p' in ffi._parser._declarations)
    assert ('anonymous foo_t' in ffi._parser._declarations)
    type_foo = ffi._parser.parse_type('foo_t')
    type_bar = type_bar._parser.parse_type('bar_p').totype
    assert (repr(type_foo) == '<foo_t>')
    assert (repr(type_bar) == '<struct $1>')
    py.test.raises(VerificationError, type_bar.get_c_name)
    assert (type_foo.get_c_name() == 'foo_t')

dataset/ETHPy150Open johncsnyder/SwiftKitten/cffi/testing/cffi0/test_parsing.py test_unnamed_struct/VarMisuse@73/156 `ffi`->`type_bar`