18 empty_input(
void **state) {
23 no_spaces(
void **state) {
24 const char *argv[] = {
"crm_resource",
"-r",
"rsc1",
"--meta",
"-p",
"comment",
"-v",
"hello",
"--output-as=xml", NULL };
25 const gchar *expected =
"crm_resource -r rsc1 --meta -p comment -v hello --output-as=xml";
28 assert_string_equal(processed, expected);
33 spaces_no_quote(
void **state) {
34 const char *argv[] = {
"crm_resource",
"-r",
"rsc1",
"--meta",
"-p",
"comment",
"-v",
"hello world",
"--output-as=xml", NULL };
35 const gchar *expected =
"crm_resource -r rsc1 --meta -p comment -v 'hello world' --output-as=xml";
38 assert_string_equal(processed, expected);
43 spaces_with_quote(
void **state) {
44 const char *argv[] = {
"crm_resource",
"-r",
"rsc1",
"--meta",
"-p",
"comment",
"-v",
"here's johnny",
"--output-as=xml", NULL };
45 const gchar *expected =
"crm_resource -r rsc1 --meta -p comment -v 'here\\\'s johnny' --output-as=xml";
48 assert_string_equal(processed, expected);
53 cmocka_unit_test(empty_input),
54 cmocka_unit_test(no_spaces),
55 cmocka_unit_test(spaces_no_quote),
56 cmocka_unit_test(spaces_with_quote))
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))
gchar * pcmk__quote_cmdline(gchar **argv)