object-introspection/test/integration/enums.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

49 lines
1.0 KiB
TOML

definitions = '''
enum class ScopedEnum {
CaseA,
CaseB,
CaseC,
};
enum class ScopedEnumInt8 : int8_t {
CaseA,
CaseB,
CaseC,
};
enum UNSCOPED_ENUM {
CASE_A,
CASE_B,
CASE_C,
};
struct Holder {
enum {
One,
Two,
} e;
};
'''
[cases]
[cases.scoped]
param_types = ["ScopedEnum"]
setup = "return {};"
expect_json = '[{"staticSize":4, "dynamicSize":0}]'
[cases.scoped_int8]
param_types = ["ScopedEnumInt8"]
setup = "return {};"
expect_json = '[{"staticSize":1, "dynamicSize":0}]'
[cases.unscoped]
param_types = ["UNSCOPED_ENUM"]
setup = "return {};"
expect_json = '[{"staticSize":4, "dynamicSize":0}]'
[cases.anonymous]
skip = "TreeBuilder crashes" # https://github.com/facebookexperimental/object-introspection/issues/232
param_types = ["Holder&"]
setup = "return {};"
expect_json = '''[
{"staticSize":4, "dynamicSize":0, "exclusiveSize":0, "members":[
{"name":"e", "staticSize":4, "dynamicSize":0, "exclusiveSize":4}
]}]'''