pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
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
15static pcmk__output_t *
16null_create_fn(char **argv) {
17 return NULL;
18}
19
20static void
21invalid_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
29static void
30non_null_formatters(void **state) {
31 pcmk__register_format(NULL, "fake", null_create_fn, NULL);
32
34 assert_null(pcmk__output_formatters());
35}
36
37PCMK__UNIT_TEST(NULL, NULL,
38 cmocka_unit_test(invalid_params),
39 cmocka_unit_test(non_null_formatters))
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:127
void pcmk__unregister_formats(void)
Definition output.c:168
This structure contains everything that makes up a single output formatter.
#define PCMK__UNIT_TEST(group_setup, group_teardown,...)