pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
pcmk__unregister_formats_test.c
Go to the documentation of this file.
1 /*
2  * Copyright 2022 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU General Public License version 2
7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
8  */
9 
10 #include <crm_internal.h>
11 
14 
15 static pcmk__output_t *
16 null_create_fn(char **argv) {
17  return NULL;
18 }
19 
20 static void
21 invalid_params(void **state) {
22  /* This is basically just here to make sure that calling pcmk__unregister_formats
23  * with formatters=NULL doesn't segfault.
24  */
26  assert_null(pcmk__output_formatters());
27 }
28 
29 static void
30 non_null_formatters(void **state) {
31  pcmk__register_format(NULL, "fake", null_create_fn, NULL);
32 
34  assert_null(pcmk__output_formatters());
35 }
36 
37 PCMK__UNIT_TEST(NULL, NULL,
38  cmocka_unit_test(invalid_params),
39  cmocka_unit_test(non_null_formatters))
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))
Formatted output for pacemaker tools.
int pcmk__register_format(GOptionGroup *group, const char *name, pcmk__output_factory_t create, const GOptionEntry *options)
Definition: output.c:126
void pcmk__unregister_formats(void)
Definition: output.c:158
This structure contains everything that makes up a single output formatter.