object-introspection/test/integration/typedefs.toml
Alastair Robertson 9f9d1eb568 TypeGraph: Better handling for anonymous types
- Assign names to anonymous types
- Deduplicate all enums (anonymous or not)
- Add tests
2023-07-12 17:44:38 +01:00

89 lines
2.1 KiB
TOML

includes = ["vector"]
definitions = '''
typedef uint64_t TdUInt64;
using UsingUInt64 = uint64_t;
using IntVector = std::vector<int>;
using Anonymous = struct { int n; };
'''
[cases]
[cases.c_style]
param_types = ["TdUInt64"]
setup = "return {};"
expect_json = '''[{
"staticSize":8,
"dynamicSize":0,
"isTypedef":true,
"typeName":"TdUInt64",
"members":[
{
"staticSize":8,
"dynamicSize":0,
"isTypedef":false,
"typeName":"uint64_t",
"NOT":"members"
}
]}]'''
[cases.using]
param_types = ["UsingUInt64"]
setup = "return {};"
expect_json = '''[{
"staticSize":8,
"dynamicSize":0,
"isTypedef":true,
"typeName":"UsingUInt64",
"members":[
{
"staticSize":8,
"dynamicSize":0,
"isTypedef":false,
"typeName":"uint64_t",
"NOT":"members"
}
]}]'''
[cases.container]
param_types = ["const IntVector&"]
setup = "return {};"
expect_json = '''[{
"staticSize":24,
"dynamicSize":0,
"isTypedef":true,
"typeName":"IntVector",
"members":[
{
"staticSize":24,
"dynamicSize":0,
"length":0,
"capacity":0,
"elementStaticSize":4,
"isTypedef":false,
"typeName":"vector<int, std::allocator<int> >",
"NOT":"members"
}
]}]'''
[cases.anonymous]
oil_skip = "TreeBuilder crashes" # https://github.com/facebookexperimental/object-introspection/issues/232
param_types = ["const Anonymous&"]
setup = "return {};"
expect_json = '''[{
"staticSize":4,
"dynamicSize":0,
"exclusiveSize":0,
"isTypedef":true,
"typeName":"Anonymous",
"members":[
{
"staticSize":4,
"dynamicSize":0,
"exclusiveSize":0,
"isTypedef":false,
"members":[
{
"staticSize":4,
"dynamicSize":0,
"exclusiveSize":4,
"isTypedef":false,
"name": "n"
}
]}
]}]'''