50 mk_fake_text_output(
char **argv) {
58 retval->
init = fake_text_init;
74 teardown(
void **state) {
80 no_such_message(
void **state) {
85 assert_int_equal(out->
message(out,
"fake"), EINVAL);
93 message_return_value(
void **state) {
97 {
"msg1",
"text", message_fn_1 },
98 {
"msg2",
"text", message_fn_2 },
99 {
"fail",
"text", failed_message_fn },
106 expect_function_call(message_fn_1);
108 expect_function_call(message_fn_2);
110 expect_function_call(failed_message_fn);
117 wrong_format(
void **state) {
121 {
"msg1",
"xml", message_fn_1 },
128 assert_int_equal(out->
message(out,
"msg1"), EINVAL);
134 default_called(
void **state) {
138 {
"msg1",
"default", default_message_fn },
139 {
"msg1",
"xml", message_fn_1 },
146 expect_function_call(default_message_fn);
153 cmocka_unit_test_setup_teardown(no_such_message, setup, teardown),
154 cmocka_unit_test_setup_teardown(message_return_value, setup, teardown),
155 cmocka_unit_test_setup_teardown(wrong_format, setup, teardown),
156 cmocka_unit_test_setup_teardown(default_called, setup, teardown))
void pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table)
int(* message)(pcmk__output_t *out, const char *message_id,...)
const char * fmt_name
The name of this output formatter.
void pcmk__register_message(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
int pcmk__call_message(pcmk__output_t *out, const char *message_id,...)
Formatted output for pacemaker tools.
void(* register_message)(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
void(* free_priv)(pcmk__output_t *out)
bool(* init)(pcmk__output_t *out)
#define pcmk__assert_asserts(stmt)
int pcmk__register_format(GOptionGroup *group, const char *name, pcmk__output_factory_t create, const GOptionEntry *options)
void pcmk__output_free(pcmk__output_t *out)
void pcmk__unregister_formats(void)
This structure contains everything that makes up a single output formatter.
int pcmk__output_new(pcmk__output_t **out, const char *fmt_name, const char *filename, char **argv)