object-introspection/test/integration/enums.toml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.7 KiB
TOML
Raw Normal View History

2023-02-14 13:58:34 +00:00
definitions = '''
enum class ScopedEnum {
CaseA,
CaseB,
CaseC,
};
2023-09-19 17:25:58 +01:00
enum class ScopedEnumUint8 : uint8_t {
CaseA = 2,
CaseB = 3,
CaseC = 4,
2023-02-14 13:58:34 +00:00
};
enum UNSCOPED_ENUM {
CASE_A = 5,
CASE_B = -2,
CASE_C = 20,
2023-02-14 13:58:34 +00:00
};
struct Holder {
enum {
One,
Two,
} e;
};
2023-09-19 17:25:58 +01:00
template <typename T1, typename T2>
struct Pair {
T1 first;
T2 second;
};
2023-02-14 13:58:34 +00:00
'''
[cases]
[cases.scoped]
param_types = ["ScopedEnum"]
setup = "return {};"
expect_json = '[{"staticSize":4, "dynamicSize":0}]'
2023-09-19 17:25:58 +01:00
expect_json_v2 = '[{"typeNames": ["ScopedEnum"], "staticSize":4, "exclusiveSize":4}]'
[cases.scoped_uint8]
param_types = ["ScopedEnumUint8"]
2023-02-14 13:58:34 +00:00
setup = "return {};"
expect_json = '[{"staticSize":1, "dynamicSize":0}]'
2023-09-19 17:25:58 +01:00
expect_json_v2 = '[{"typeNames": ["ScopedEnumUint8"], "staticSize":1, "exclusiveSize":1}]'
2023-02-14 13:58:34 +00:00
[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}
]}]'''
2023-09-19 17:25:58 +01:00
[cases.paired_with_element]
param_types = ["Pair<ScopedEnumUint8, uint8_t>"]
setup = "return {};"
expect_json = '[{"staticSize":2, "dynamicSize":0}]'
expect_json_v2 = '''[
{"staticSize": 2, "exclusiveSize": 0, "members": [
{"typeNames": ["ScopedEnumUint8"], "staticSize":1, "exclusiveSize":1},
{"typeNames": ["uint8_t"], "staticSize":1, "exclusiveSize":1}
]}
]'''