object-introspection/test/integration/typedefs.toml
Jake Hillion 5071519e45 oil v2
2023-08-23 15:59:53 +01:00

98 lines
2.3 KiB
TOML

includes = ["vector"]
definitions = '''
typedef uint64_t TdUInt64;
using UsingUInt64 = uint64_t;
using IntVector = std::vector<int>;
using Anonymous = struct { int n; };
template <typename T>
struct Proxy {
T t;
};
'''
[cases]
[cases.c_style]
oil_disable = "oil can't pick up top level typedefs"
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]
oil_disable = "oil can't pick up top level typedefs"
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]
oil_disable = "oil can't pick up top level typedefs"
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_disable = "oil can't pick up top level typedefs"
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"
}
]}
]}]'''