tests: Exercise gdbus-codegen --interface-info-body with empty input

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2024-02-06 13:40:33 +00:00
parent 1ba8386886
commit 02a3417ac4

View File

@ -145,6 +145,7 @@ class TestCodegen(unittest.TestCase):
"#ifdef G_OS_UNIX\n"
"# include <gio/gunixfdlist.h>\n"
"#endif",
"interface_info_header_includes": "#include <string.h>",
"private_gvalues_getters": """#ifdef G_ENABLE_DEBUG
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
#define g_marshal_value_peek_char(v) g_value_get_schar (v)
@ -395,6 +396,25 @@ G_END_DECLS
result.out.strip(),
)
def test_empty_interface_info_body(self):
"""Test generating a body with an empty interface file."""
result = self.runCodegenWithInterface(
"", "--output", "-", "--interface-info-body"
)
self.assertEqual("", result.err)
self.assertEqual(
"""{standard_top_comment}
{standard_config_h_include}
#include "-.h"
{interface_info_header_includes}""".format(
**result.subs
),
result.out.strip(),
)
def test_reproducible(self):
"""Test builds are reproducible regardless of file ordering."""
xml_contents1 = """