From 4c10619bdc8b4863abaddb00b940f9c50197f0fe Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 17 Oct 2023 19:17:55 +0100 Subject: test: drop TEST_MSG newline --- test/address/config_type.c | 146 +++++++++++------------ test/atoi/mutt_str_atoi.c | 6 +- test/atoi/mutt_str_atol.c | 6 +- test/atoi/mutt_str_atos.c | 6 +- test/atoi/mutt_str_atoui.c | 6 +- test/atoi/mutt_str_atoul.c | 6 +- test/atoi/mutt_str_atoull.c | 6 +- test/common.c | 10 +- test/config/account.c | 44 +++---- test/config/bool.c | 202 ++++++++++++++++---------------- test/config/common.c | 8 +- test/config/enum.c | 178 ++++++++++++++-------------- test/config/initial.c | 8 +- test/config/long.c | 234 ++++++++++++++++++------------------- test/config/mbtable.c | 152 ++++++++++++------------ test/config/myvar.c | 124 ++++++++++---------- test/config/number.c | 256 ++++++++++++++++++++--------------------- test/config/path.c | 166 +++++++++++++------------- test/config/quad.c | 182 ++++++++++++++--------------- test/config/regex.c | 168 +++++++++++++-------------- test/config/set.c | 54 ++++----- test/config/slist.c | 178 ++++++++++++++-------------- test/config/sort.c | 192 +++++++++++++++---------------- test/config/string.c | 192 +++++++++++++++---------------- test/config/subset.c | 54 ++++----- test/config/synonym.c | 34 +++--- test/config/variable.c | 16 +-- test/gui/reflow.c | 140 +++++++++++----------- test/mbyte/mutt_mb_width.c | 16 +-- test/parse/parse_rc_line.c | 126 ++++++++++---------- test/pattern/comp.c | 28 ++--- test/string/mutt_str_sysexit.c | 2 +- 32 files changed, 1473 insertions(+), 1473 deletions(-) diff --git a/test/address/config_type.c b/test/address/config_type.c index 749499a86..c4052cd8d 100644 --- a/test/address/config_type.c +++ b/test/address/config_type.c @@ -61,21 +61,21 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const struct Address *VarApple = cs_subset_address(sub, "Apple"); const struct Address *VarBanana = cs_subset_address(sub, "Banana"); - TEST_MSG("Apple = '%s'\n", buf_string(VarApple->mailbox)); - TEST_MSG("Banana = '%s'\n", buf_string(VarBanana->mailbox)); + TEST_MSG("Apple = '%s'", buf_string(VarApple->mailbox)); + TEST_MSG("Banana = '%s'", buf_string(VarBanana->mailbox)); const char *apple_orig = "apple@example.com"; const char *banana_orig = "banana@example.com"; if (!TEST_CHECK_STR_EQ(buf_string(VarApple->mailbox), apple_orig)) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } if (!TEST_CHECK_STR_EQ(buf_string(VarBanana->mailbox), banana_orig)) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } @@ -93,39 +93,39 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), apple_orig)) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Apple = '%s'\n", VarApple->mailbox); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple->mailbox); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), banana_orig)) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Banana = '%s'\n", VarBanana ? buf_string(VarBanana->mailbox) : ""); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana ? buf_string(VarBanana->mailbox) : ""); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "john@doe.com", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -133,7 +133,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "jane@doe.com", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -141,13 +141,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } const struct Address *VarCherry = cs_subset_address(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry ? buf_string(VarCherry->mailbox) : ""); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry ? buf_string(VarCherry->mailbox) : ""); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -171,7 +171,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -179,10 +179,10 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) addr = VarDamson ? VarDamson->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, buf_string(addr), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, buf_string(addr), NONULL(valid[i])); } name = "Elderberry"; @@ -192,7 +192,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -200,10 +200,10 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) addr = VarElderberry ? VarElderberry->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, buf_string(addr), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, buf_string(addr), NONULL(valid[i])); } log_line(__func__); @@ -221,24 +221,24 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Address *VarFig = cs_subset_address(sub, "Fig"); addr = VarFig ? VarFig->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr), buf_string(err)); name = "Guava"; buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Address *VarGuava = cs_subset_address(sub, "Guava"); addr = VarGuava ? VarGuava->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr), buf_string(err)); name = "Hawthorn"; rc = cs_str_string_set(cs, name, "hawthorn", err); @@ -249,12 +249,12 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Address *VarHawthorn = cs_subset_address(sub, "Hawthorn"); addr = VarHawthorn ? VarHawthorn->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr), buf_string(err)); log_line(__func__); return true; @@ -274,7 +274,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_native_set(cs, name, (intptr_t) a, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tbns_out; } @@ -282,28 +282,28 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) addr = VarIlama ? VarIlama->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), buf_string(a->mailbox))) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tbns_out; } - TEST_MSG("%s = '%s', set by '%s'\n", name, buf_string(addr), buf_string(a->mailbox)); + TEST_MSG("%s = '%s', set by '%s'", name, buf_string(addr), buf_string(a->mailbox)); name = "Jackfruit"; buf_reset(err); rc = cs_str_native_set(cs, name, 0, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tbns_out; } const struct Address *VarJackfruit = cs_subset_address(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit == NULL)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tbns_out; } addr = VarJackfruit ? VarJackfruit->mailbox : NULL; - TEST_MSG("%s = '%s', set by NULL\n", name, buf_string(addr)); + TEST_MSG("%s = '%s', set by NULL", name, buf_string(addr)); log_line(__func__); result = true; @@ -328,12 +328,12 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) const struct Address *VarKumquat = cs_subset_address(sub, "Kumquat"); if (!TEST_CHECK(VarKumquat == a)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } struct Buffer *addr1 = VarKumquat ? VarKumquat->mailbox : NULL; struct Buffer *addr2 = a ? a->mailbox : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, buf_string(addr1), buf_string(addr2)); + TEST_MSG("%s = '%s', '%s'", name, buf_string(addr1), buf_string(addr2)); log_line(__func__); return true; @@ -350,18 +350,18 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) const struct Address *VarLemon = cs_subset_address(sub, "Lemon"); struct Buffer *addr = VarLemon ? VarLemon->mailbox : NULL; - TEST_MSG("Initial: %s = '%s'\n", name, buf_string(addr)); + TEST_MSG("Initial: %s = '%s'", name, buf_string(addr)); int rc = cs_str_string_set(cs, name, "hello@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarLemon = cs_subset_address(sub, "Lemon"); addr = VarLemon ? VarLemon->mailbox : NULL; - TEST_MSG("Set: %s = '%s'\n", name, buf_string(addr)); + TEST_MSG("Set: %s = '%s'", name, buf_string(addr)); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -369,44 +369,44 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) addr = VarLemon ? VarLemon->mailbox : NULL; if (!TEST_CHECK_STR_EQ(buf_string(addr), "lemon@example.com")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, buf_string(addr)); + TEST_MSG("Reset: %s = '%s'", name, buf_string(addr)); name = "Mango"; buf_reset(err); const struct Address *VarMango = cs_subset_address(sub, "Mango"); - TEST_MSG("Initial: %s = '%s'\n", name, buf_string(VarMango->mailbox)); + TEST_MSG("Initial: %s = '%s'", name, buf_string(VarMango->mailbox)); dont_fail = true; rc = cs_str_string_set(cs, name, "john@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarMango = cs_subset_address(sub, "Mango"); - TEST_MSG("Set: %s = '%s'\n", name, buf_string(VarMango->mailbox)); + TEST_MSG("Set: %s = '%s'", name, buf_string(VarMango->mailbox)); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarMango = cs_subset_address(sub, "Mango"); if (!TEST_CHECK_STR_EQ(buf_string(VarMango->mailbox), "john@example.com")) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, buf_string(VarMango->mailbox)); + TEST_MSG("Reset: %s = '%s'", name, buf_string(VarMango->mailbox)); log_line(__func__); return true; @@ -426,93 +426,93 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "hello@example.com", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Address *VarNectarine = cs_subset_address(sub, "Nectarine"); addr = VarNectarine ? VarNectarine->mailbox : NULL; - TEST_MSG("Address: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Address: %s = %s", name, buf_string(addr)); buf_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarNectarine = cs_subset_address(sub, "Nectarine"); addr = VarNectarine ? VarNectarine->mailbox : NULL; - TEST_MSG("Native: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Native: %s = %s", name, buf_string(addr)); name = "Olive"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello@example.com", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Address *VarOlive = cs_subset_address(sub, "Olive"); addr = VarOlive ? VarOlive->mailbox : NULL; - TEST_MSG("Address: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Address: %s = %s", name, buf_string(addr)); buf_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarOlive = cs_subset_address(sub, "Olive"); addr = VarOlive ? VarOlive->mailbox : NULL; - TEST_MSG("Native: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Native: %s = %s", name, buf_string(addr)); name = "Papaya"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello@example.com", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Address *VarPapaya = cs_subset_address(sub, "Papaya"); addr = VarPapaya ? VarPapaya->mailbox : NULL; - TEST_MSG("Address: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Address: %s = %s", name, buf_string(addr)); buf_reset(err); rc = cs_str_native_set(cs, name, IP a, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarPapaya = cs_subset_address(sub, "Papaya"); addr = VarPapaya ? VarPapaya->mailbox : NULL; - TEST_MSG("Native: %s = %s\n", name, buf_string(addr)); + TEST_MSG("Native: %s = %s", name, buf_string(addr)); result = true; tv_out: @@ -532,8 +532,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch struct Buffer *pstr = pa ? pa->mailbox : NULL; struct Buffer *cstr = ca ? ca->mailbox : NULL; - TEST_MSG("%15s = %s\n", parent, buf_string(pstr)); - TEST_MSG("%15s = %s\n", child, buf_string(cstr)); + TEST_MSG("%15s = %s", parent, buf_string(pstr)); + TEST_MSG("%15s = %s", child, buf_string(cstr)); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -553,7 +553,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -562,7 +562,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "hello@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -572,7 +572,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "world@example.com", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -582,7 +582,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -592,7 +592,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/atoi/mutt_str_atoi.c b/test/atoi/mutt_str_atoi.c index 05ff30934..e97626755 100644 --- a/test/atoi/mutt_str_atoi.c +++ b/test/atoi/mutt_str_atoi.c @@ -107,15 +107,15 @@ void test_mutt_str_atoi(void) if ((tests[i].retval == 0) && (!end || *end)) { - TEST_MSG("retval: Expected: \\0, Got: %s\n", end); + TEST_MSG("retval: Expected: \\0, Got: %s", end); } else if ((tests[i].retval == -1) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } else if ((tests[i].retval == -2) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } } } diff --git a/test/atoi/mutt_str_atol.c b/test/atoi/mutt_str_atol.c index 8d69d2c2c..b5867288e 100644 --- a/test/atoi/mutt_str_atol.c +++ b/test/atoi/mutt_str_atol.c @@ -135,15 +135,15 @@ void test_mutt_str_atol(void) if ((tests[i].retval == 0) && (!end || *end)) { - TEST_MSG("retval: Expected: \\0, Got: %s\n", end); + TEST_MSG("retval: Expected: \\0, Got: %s", end); } else if ((tests[i].retval == -1) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } else if ((tests[i].retval == -2) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } } } diff --git a/test/atoi/mutt_str_atos.c b/test/atoi/mutt_str_atos.c index d3fd6779e..831d17f3b 100644 --- a/test/atoi/mutt_str_atos.c +++ b/test/atoi/mutt_str_atos.c @@ -107,15 +107,15 @@ void test_mutt_str_atos(void) if ((tests[i].retval == 0) && (!end || *end)) { - TEST_MSG("retval: Expected: \\0, Got: %s\n", end); + TEST_MSG("retval: Expected: \\0, Got: %s", end); } else if ((tests[i].retval == -1) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } else if ((tests[i].retval == -2) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } } } diff --git a/test/atoi/mutt_str_atoui.c b/test/atoi/mutt_str_atoui.c index 2125578b8..1c887c808 100644 --- a/test/atoi/mutt_str_atoui.c +++ b/test/atoi/mutt_str_atoui.c @@ -105,15 +105,15 @@ void test_mutt_str_atoui(void) if ((tests[i].retval == 0) && (!end || *end)) { - TEST_MSG("retval: Expected: \\0, Got: %s\n", end); + TEST_MSG("retval: Expected: \\0, Got: %s", end); } else if ((tests[i].retval == -1) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } else if ((tests[i].retval == -2) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } } } diff --git a/test/atoi/mutt_str_atoul.c b/test/atoi/mutt_str_atoul.c index 6f46d8048..5c8d4a83c 100644 --- a/test/atoi/mutt_str_atoul.c +++ b/test/atoi/mutt_str_atoul.c @@ -112,15 +112,15 @@ void test_mutt_str_atoul(void) if ((tests[i].retval == 0) && (!end || *end)) { - TEST_MSG("retval: Expected: \\0, Got: %s\n", end); + TEST_MSG("retval: Expected: \\0, Got: %s", end); } else if ((tests[i].retval == -1) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } else if ((tests[i].retval == -2) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } } } diff --git a/test/atoi/mutt_str_atoull.c b/test/atoi/mutt_str_atoull.c index f37f7119c..436922569 100644 --- a/test/atoi/mutt_str_atoull.c +++ b/test/atoi/mutt_str_atoull.c @@ -92,15 +92,15 @@ void test_mutt_str_atoull(void) if ((tests[i].retval == 0) && (!end || *end)) { - TEST_MSG("retval: Expected: \\0, Got: %s\n", end); + TEST_MSG("retval: Expected: \\0, Got: %s", end); } else if ((tests[i].retval == -1) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } else if ((tests[i].retval == -2) && end) { - TEST_MSG("retval: Expected: NULL, Got: %s\n", end); + TEST_MSG("retval: Expected: NULL, Got: %s", end); } } } diff --git a/test/common.c b/test/common.c index 82df157cd..bd710b90d 100644 --- a/test/common.c +++ b/test/common.c @@ -127,14 +127,14 @@ void test_init(void) TEST_CASE("Common setup"); if (!TEST_CHECK(path != NULL)) { - TEST_MSG("Environment variable '%s' isn't set\n", TEST_DIR); + TEST_MSG("Environment variable '%s' isn't set", TEST_DIR); goto done; } size_t len = strlen(path); if (!TEST_CHECK(path[len - 1] != '/')) { - TEST_MSG("Environment variable '%s' mustn't end with a '/'\n", TEST_DIR); + TEST_MSG("Environment variable '%s' mustn't end with a '/'", TEST_DIR); goto done; } @@ -142,13 +142,13 @@ void test_init(void) if (!TEST_CHECK(stat(path, &st) == 0)) { - TEST_MSG("Test dir '%s' doesn't exist\n", path); + TEST_MSG("Test dir '%s' doesn't exist", path); goto done; } if (!TEST_CHECK(S_ISDIR(st.st_mode) == true)) { - TEST_MSG("Test dir '%s' isn't a directory\n", path); + TEST_MSG("Test dir '%s' isn't a directory", path); goto done; } @@ -163,7 +163,7 @@ void test_init(void) success = true; done: if (!success) - TEST_MSG("See: https://github.com/neomutt/neomutt-test-files#test-files\n"); + TEST_MSG("See: https://github.com/neomutt/neomutt-test-files#test-files"); } void test_fini(void) diff --git a/test/config/account.c b/test/config/account.c index 42998bb43..f25911f96 100644 --- a/test/config/account.c +++ b/test/config/account.c @@ -68,12 +68,12 @@ void test_config_account(void) if (he) { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } else { - TEST_MSG("Expected error:\n"); + TEST_MSG("Expected error:"); } account_free(&a); @@ -84,7 +84,7 @@ void test_config_account(void) struct HashElem *he2 = cs_subset_create_inheritance(a->sub, "Apple"); if (!he1 || !he2 || (he1 != he2)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return; } @@ -113,40 +113,40 @@ void test_config_account(void) rc = cs_subset_he_native_set(NULL, he, 33, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } rc = cs_subset_he_native_set(a->sub, NULL, 33, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } rc = cs_subset_he_native_set(a->sub, he, 33, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } buf_reset(err); rc = cs_subset_he_string_get(a->sub, he, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s = %s\n", he->key.strkey, buf_string(err)); + TEST_MSG("%s = %s", he->key.strkey, buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } he = cs_subset_lookup(a->sub, "Cherry"); @@ -154,11 +154,11 @@ void test_config_account(void) rc = cs_subset_he_string_get(a->sub, he, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s = %s\n", he->key.strkey, buf_string(err)); + TEST_MSG("%s = %s", he->key.strkey, buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } const char *name = "fruit:Apple"; @@ -166,11 +166,11 @@ void test_config_account(void) rc = cs_str_string_get(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s = '%s'\n", name, buf_string(err)); + TEST_MSG("%s = '%s'", name, buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return; } @@ -178,11 +178,11 @@ void test_config_account(void) rc = cs_str_native_set(cs, name, 42, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Set %s\n", name); + TEST_MSG("Set %s", name); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return; } @@ -194,11 +194,11 @@ void test_config_account(void) rc = cs_str_initial_set(cs, name, "42", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error\n"); + TEST_MSG("Expected error"); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -206,11 +206,11 @@ void test_config_account(void) rc = cs_str_initial_get(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Initial %s\n", buf_string(err)); + TEST_MSG("Initial %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return; } @@ -223,11 +223,11 @@ void test_config_account(void) rc = cs_he_native_set(cs, he, 42, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Set %s\n", name); + TEST_MSG("Set %s", name); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return; } diff --git a/test/config/bool.c b/test/config/bool.c index ddde6bc8b..14556abc9 100644 --- a/test/config/bool.c +++ b/test/config/bool.c @@ -63,19 +63,19 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) bool VarApple = cs_subset_bool(sub, "Apple"); bool VarBanana = cs_subset_bool(sub, "Banana"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Banana = %d\n", VarBanana); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Banana = %d", VarBanana); if (!TEST_CHECK(VarApple == false)) { - TEST_MSG("Expected: %d\n", false); - TEST_MSG("Actual : %d\n", VarApple); + TEST_MSG("Expected: %d", false); + TEST_MSG("Actual : %d", VarApple); } if (!TEST_CHECK(VarBanana == true)) { - TEST_MSG("Expected: %d\n", true); - TEST_MSG("Actual : %d\n", VarBanana); + TEST_MSG("Expected: %d", true); + TEST_MSG("Actual : %d", VarBanana); } cs_str_string_set(cs, "Apple", "true", err); @@ -89,43 +89,43 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "no")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_bool(sub, "Apple"); - TEST_MSG("Apple = '%s'\n", VarApple ? "yes" : "no"); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple ? "yes" : "no"); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "yes")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } VarBanana = cs_subset_bool(sub, "Banana"); - TEST_MSG("Banana = '%s'\n", VarBanana ? "yes" : "no"); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana ? "yes" : "no"); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "yes", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -133,13 +133,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } bool VarCherry = cs_subset_bool(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry ? "yes" : "no"); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry ? "yes" : "no"); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -169,22 +169,22 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) { cs_str_native_set(cs, name, ((i + 1) % 2), NULL); - TEST_MSG("Setting %s to %s\n", name, valid[i]); + TEST_MSG("Setting %s to %s", name, valid[i]); buf_reset(err); rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarDamson = cs_subset_bool(sub, "Damson"); if (VarDamson != (i % 2)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); short_line(); } @@ -192,11 +192,11 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "yes", err); if (TEST_CHECK(rc & CSR_SUC_NO_CHANGE)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -207,13 +207,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_bool(sub, "Damson"); - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -236,29 +236,29 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } bool VarElderberry = cs_subset_bool(sub, "Elderberry"); - TEST_MSG("%s = %d, %s\n", name, VarElderberry, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarElderberry, buf_string(err)); cs_str_native_set(cs, name, true, NULL); buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } VarElderberry = cs_subset_bool(sub, "Elderberry"); - TEST_MSG("%s = %d, %s\n", name, VarElderberry, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarElderberry, buf_string(err)); // cs_str_native_set(cs, name, 3, NULL); // buf_reset(err); // rc = cs_str_string_get(cs, name, err); // if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) // { - // TEST_MSG("Get succeeded with invalid value: %s\n", buf_string(err)); + // TEST_MSG("Get succeeded with invalid value: %s", buf_string(err)); // return false; // } @@ -274,38 +274,38 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) const char *name = "Fig"; bool value = true; - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); cs_str_native_set(cs, name, false, NULL); buf_reset(err); int rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } bool VarFig = cs_subset_bool(sub, "Fig"); if (!TEST_CHECK(VarFig == value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set to '%d'\n", name, VarFig, value); + TEST_MSG("%s = %d, set to '%d'", name, VarFig, value); short_line(); buf_reset(err); - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK((rc & CSR_SUC_NO_CHANGE) != 0)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); } int invalid[] = { -1, 2 }; @@ -313,18 +313,18 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) { short_line(); cs_str_native_set(cs, name, false, NULL); - TEST_MSG("Setting %s to %d\n", name, invalid[i]); + TEST_MSG("Setting %s to %d", name, invalid[i]); buf_reset(err); rc = cs_str_native_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarFig = cs_subset_bool(sub, "Fig"); - TEST_MSG("%s = %d, set by '%d'\n", name, VarFig, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%d'", name, VarFig, invalid[i]); + TEST_MSG("This test should have failed"); return false; } } @@ -345,10 +345,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = %ld\n", name, value); + TEST_MSG("%s = %ld", name, value); log_line(__func__); return true; @@ -364,67 +364,67 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); bool VarHawthorn = cs_subset_bool(sub, "Hawthorn"); - TEST_MSG("%s = %d\n", name, VarHawthorn); + TEST_MSG("%s = %d", name, VarHawthorn); int rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarHawthorn = cs_subset_bool(sub, "Hawthorn"); if (!TEST_CHECK(VarHawthorn != true)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarHawthorn); + TEST_MSG("Reset: %s = %d", name, VarHawthorn); short_line(); name = "Ilama"; buf_reset(err); bool VarIlama = cs_subset_bool(sub, "Ilama"); - TEST_MSG("Initial: %s = %d\n", name, VarIlama); + TEST_MSG("Initial: %s = %d", name, VarIlama); dont_fail = true; rc = cs_str_string_set(cs, name, "yes", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarIlama = cs_subset_bool(sub, "Ilama"); - TEST_MSG("Set: %s = %d\n", name, VarIlama); + TEST_MSG("Set: %s = %d", name, VarIlama); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } rc = cs_str_reset(cs, "unknown", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarIlama = cs_subset_bool(sub, "Ilama"); if (!TEST_CHECK(VarIlama)) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarIlama); + TEST_MSG("Reset: %s = %d", name, VarIlama); log_line(__func__); return true; @@ -441,15 +441,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "yes", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } bool VarJackfruit = cs_subset_bool(sub, "Jackfruit"); - TEST_MSG("String: %s = %d\n", name, VarJackfruit); + TEST_MSG("String: %s = %d", name, VarJackfruit); short_line(); cs_str_native_set(cs, name, false, NULL); @@ -457,15 +457,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 1, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarJackfruit = cs_subset_bool(sub, "Jackfruit"); - TEST_MSG("Native: %s = %d\n", name, VarJackfruit); + TEST_MSG("Native: %s = %d", name, VarJackfruit); short_line(); name = "Kumquat"; @@ -474,15 +474,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "yes", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } bool VarKumquat = cs_subset_bool(sub, "Kumquat"); - TEST_MSG("String: %s = %d\n", name, VarKumquat); + TEST_MSG("String: %s = %d", name, VarKumquat); short_line(); cs_str_native_set(cs, name, false, NULL); @@ -490,15 +490,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 1, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarKumquat = cs_subset_bool(sub, "Kumquat"); - TEST_MSG("Native: %s = %d\n", name, VarKumquat); + TEST_MSG("Native: %s = %d", name, VarKumquat); short_line(); name = "Lemon"; @@ -507,15 +507,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "yes", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } bool VarLemon = cs_subset_bool(sub, "Lemon"); - TEST_MSG("String: %s = %d\n", name, VarLemon); + TEST_MSG("String: %s = %d", name, VarLemon); short_line(); cs_str_native_set(cs, name, false, NULL); @@ -523,15 +523,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 1, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_bool(sub, "Lemon"); - TEST_MSG("Native: %s = %d\n", name, VarLemon); + TEST_MSG("Native: %s = %d", name, VarLemon); log_line(__func__); return true; @@ -542,8 +542,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %ld\n", parent, pval); - TEST_MSG("%15s = %ld\n", child, cval); + TEST_MSG("%15s = %ld", parent, pval); + TEST_MSG("%15s = %ld", child, cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -563,7 +563,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -573,7 +573,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "1", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -584,12 +584,12 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "0", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", parent); + TEST_MSG("Value of %s wasn't changed", parent); } dump_native(cs, parent, child); short_line(); @@ -599,7 +599,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -613,7 +613,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -649,28 +649,28 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) rc = bool_he_toggle(NULL, he, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } rc = bool_he_toggle(NeoMutt->sub, NULL, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } rc = bool_str_toggle(NULL, "Apple", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } rc = bool_str_toggle(NeoMutt->sub, NULL, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } @@ -678,35 +678,35 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) { bool before = tests[i].before; bool after = tests[i].after; - TEST_MSG("test %zu\n", i); + TEST_MSG("test %zu", i); cs_str_native_set(cs, name, before, NULL); buf_reset(err); intptr_t value = cs_he_native_get(cs, he, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } bool copy = value; if (!TEST_CHECK(copy == before)) { - TEST_MSG("Initial value is wrong: %s\n", buf_string(err)); + TEST_MSG("Initial value is wrong: %s", buf_string(err)); return false; } rc = bool_he_toggle(NeoMutt->sub, he, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Toggle failed: %s\n", buf_string(err)); + TEST_MSG("Toggle failed: %s", buf_string(err)); return false; } bool VarNectarine = cs_subset_bool(sub, "Nectarine"); if (!TEST_CHECK(VarNectarine == after)) { - TEST_MSG("Toggle value is wrong: %s\n", buf_string(err)); + TEST_MSG("Toggle value is wrong: %s", buf_string(err)); return false; } short_line(); @@ -716,35 +716,35 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) { bool before = tests[i].before; bool after = tests[i].after; - TEST_MSG("test %zu\n", i); + TEST_MSG("test %zu", i); cs_str_native_set(cs, name, before, NULL); buf_reset(err); intptr_t value = cs_he_native_get(cs, he, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } bool copy = value; if (!TEST_CHECK(copy == before)) { - TEST_MSG("Initial value is wrong: %s\n", buf_string(err)); + TEST_MSG("Initial value is wrong: %s", buf_string(err)); return false; } rc = bool_str_toggle(NeoMutt->sub, "Nectarine", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Toggle failed: %s\n", buf_string(err)); + TEST_MSG("Toggle failed: %s", buf_string(err)); return false; } bool VarNectarine = cs_subset_bool(sub, "Nectarine"); if (!TEST_CHECK(VarNectarine == after)) { - TEST_MSG("Toggle value is wrong: %s\n", buf_string(err)); + TEST_MSG("Toggle value is wrong: %s", buf_string(err)); return false; } short_line(); @@ -755,7 +755,7 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) rc = bool_he_toggle(&sub2, he, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } name = "Olive"; @@ -767,18 +767,18 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) rc = bool_he_toggle(NeoMutt->sub, he, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } buf_reset(err); rc = bool_str_toggle(NeoMutt->sub, "unknown", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } diff --git a/test/config/common.c b/test/config/common.c index 366fe645d..14b196a9d 100644 --- a/test/config/common.c +++ b/test/config/common.c @@ -72,12 +72,12 @@ int validator_succeed(const struct ConfigSet *cs, const struct ConfigDef *cdef, void log_line(const char *fn) { int len = 44 - mutt_str_len(fn); - TEST_MSG("\033[36m---- %s %.*s\033[m\n", fn, len, line); + TEST_MSG("\033[36m---- %s %.*s\033[m", fn, len, line); } void short_line(void) { - TEST_MSG("%s\n", line + 40); + TEST_MSG("%s", line + 40); } int log_observer(struct NotifyCallback *nc) @@ -95,7 +95,7 @@ int log_observer(struct NotifyCallback *nc) cs_he_string_get(ec->sub->cs, ec->he, result); - TEST_MSG("Event: %s has been %s to '%s'\n", ec->name, + TEST_MSG("Event: %s has been %s to '%s'", ec->name, events[nc->event_subtype - 1], buf_string(result)); buf_pool_release(&result); @@ -174,7 +174,7 @@ void cs_dump_set(const struct ConfigSet *cs) qsort(list, index, sizeof(list[0]), sort_list_cb); for (i = 0; list[i]; i++) { - TEST_MSG("%s\n", list[i]); + TEST_MSG("%s", list[i]); FREE(&list[i]); } diff --git a/test/config/enum.c b/test/config/enum.c index 032e016c2..aed1fd743 100644 --- a/test/config/enum.c +++ b/test/config/enum.c @@ -93,19 +93,19 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) unsigned char VarApple = cs_subset_enum(sub, "Apple"); unsigned char VarBanana = cs_subset_enum(sub, "Banana"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Banana = %d\n", VarBanana); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Banana = %d", VarBanana); if (!TEST_CHECK(VarApple == ANIMAL_DINGO)) { - TEST_MSG("Expected: %d\n", ANIMAL_DINGO); - TEST_MSG("Actual : %d\n", VarApple); + TEST_MSG("Expected: %d", ANIMAL_DINGO); + TEST_MSG("Actual : %d", VarApple); } if (!TEST_CHECK(VarBanana == ANIMAL_BADGER)) { - TEST_MSG("Expected: %d\n", ANIMAL_BADGER); - TEST_MSG("Actual : %d\n", VarBanana); + TEST_MSG("Expected: %d", ANIMAL_BADGER); + TEST_MSG("Actual : %d", VarBanana); } cs_str_string_set(cs, "Apple", "Cassowary", err); @@ -122,41 +122,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "Dingo")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_enum(sub, "Apple"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "Badger")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } VarBanana = cs_subset_enum(sub, "Banana"); - TEST_MSG("Banana = %d\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = %d", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "bird", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -164,13 +164,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } unsigned char VarCherry = cs_subset_enum(sub, "Cherry"); - TEST_MSG("Cherry = %d\n", VarCherry); - TEST_MSG("Cherry's initial value is %s\n", buf_string(value)); + TEST_MSG("Cherry = %d", VarCherry); + TEST_MSG("Cherry's initial value is %s", buf_string(value)); buf_pool_release(&value); log_line(__func__); @@ -192,45 +192,45 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) { cs_str_native_set(cs, name, ANIMAL_CASSOWARY, NULL); - TEST_MSG("Setting %s to %s\n", name, valid[i]); + TEST_MSG("Setting %s to %s", name, valid[i]); buf_reset(err); rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } VarDamson = cs_subset_enum(sub, "Damson"); if (!TEST_CHECK(VarDamson == numbers[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); short_line(); } for (unsigned int i = 0; i < mutt_array_size(invalid); i++) { - TEST_MSG("Setting %s to %s\n", name, NONULL(invalid[i])); + TEST_MSG("Setting %s to %s", name, NONULL(invalid[i])); buf_reset(err); rc = cs_str_string_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_enum(sub, "Damson"); - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -239,15 +239,15 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) name = "Elderberry"; const char *value2 = "Dingo"; short_line(); - TEST_MSG("Setting %s to '%s'\n", name, value2); + TEST_MSG("Setting %s to '%s'", name, value2); rc = cs_str_string_set(cs, name, value2, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -266,22 +266,22 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } unsigned char VarFig = cs_subset_enum(sub, "Fig"); - TEST_MSG("%s = %d, %s\n", name, VarFig, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarFig, buf_string(err)); cs_str_native_set(cs, name, ANIMAL_DINGO, NULL); buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } VarFig = cs_subset_enum(sub, "Fig"); - TEST_MSG("%s = %d, %s\n", name, VarFig, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarFig, buf_string(err)); log_line(__func__); return true; @@ -294,50 +294,50 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) const char *name = "Guava"; unsigned char value = ANIMAL_CASSOWARY; - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); cs_str_native_set(cs, name, 0, NULL); buf_reset(err); int rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } unsigned char VarGuava = cs_subset_enum(sub, "Guava"); if (!TEST_CHECK(VarGuava == value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set to '%d'\n", name, VarGuava, value); + TEST_MSG("%s = %d, set to '%d'", name, VarGuava, value); short_line(); - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); rc = cs_str_native_set(cs, name, value, err); if (TEST_CHECK((rc & CSR_SUC_NO_CHANGE) != 0)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } name = "Hawthorn"; value = -42; short_line(); - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); rc = cs_str_native_set(cs, name, value, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -346,18 +346,18 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) { short_line(); cs_str_native_set(cs, name, ANIMAL_CASSOWARY, NULL); - TEST_MSG("Setting %s to %d\n", name, invalid[i]); + TEST_MSG("Setting %s to %d", name, invalid[i]); buf_reset(err); rc = cs_str_native_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarGuava = cs_subset_enum(sub, "Guava"); - TEST_MSG("%s = %d, set by '%d'\n", name, VarGuava, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%d'", name, VarGuava, invalid[i]); + TEST_MSG("This test should have failed"); return false; } } @@ -365,15 +365,15 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) name = "Elderberry"; value = ANIMAL_ANTELOPE; short_line(); - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); rc = cs_str_native_set(cs, name, value, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -392,10 +392,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = %ld\n", name, value); + TEST_MSG("%s = %ld", name, value); log_line(__func__); return true; @@ -410,56 +410,56 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); unsigned char VarJackfruit = cs_subset_enum(sub, "Jackfruit"); - TEST_MSG("%s = %d\n", name, VarJackfruit); + TEST_MSG("%s = %d", name, VarJackfruit); int rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarJackfruit = cs_subset_enum(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit != 253)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarJackfruit); + TEST_MSG("Reset: %s = %d", name, VarJackfruit); short_line(); name = "Kumquat"; buf_reset(err); unsigned char VarKumquat = cs_subset_enum(sub, "Kumquat"); - TEST_MSG("Initial: %s = %d\n", name, VarKumquat); + TEST_MSG("Initial: %s = %d", name, VarKumquat); dont_fail = true; rc = cs_str_string_set(cs, name, "Dingo", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarKumquat = cs_subset_enum(sub, "Kumquat"); - TEST_MSG("Set: %s = %d\n", name, VarKumquat); + TEST_MSG("Set: %s = %d", name, VarKumquat); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarKumquat = cs_subset_enum(sub, "Kumquat"); if (!TEST_CHECK(VarKumquat == ANIMAL_DINGO)) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarKumquat); + TEST_MSG("Reset: %s = %d", name, VarKumquat); short_line(); name = "Jackfruit"; @@ -469,7 +469,7 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -488,15 +488,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "Dingo", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } unsigned char VarLemon = cs_subset_enum(sub, "Lemon"); - TEST_MSG("String: %s = %d\n", name, VarLemon); + TEST_MSG("String: %s = %d", name, VarLemon); short_line(); cs_str_native_set(cs, name, 253, NULL); @@ -504,15 +504,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, ANIMAL_ECHIDNA, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_enum(sub, "Lemon"); - TEST_MSG("Native: %s = %d\n", name, VarLemon); + TEST_MSG("Native: %s = %d", name, VarLemon); short_line(); name = "Mango"; @@ -521,15 +521,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "bird", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } unsigned char VarMango = cs_subset_enum(sub, "Mango"); - TEST_MSG("String: %s = %d\n", name, VarMango); + TEST_MSG("String: %s = %d", name, VarMango); short_line(); cs_str_native_set(cs, name, 253, NULL); @@ -537,15 +537,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, ANIMAL_DINGO, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarMango = cs_subset_enum(sub, "Mango"); - TEST_MSG("Native: %s = %d\n", name, VarMango); + TEST_MSG("Native: %s = %d", name, VarMango); short_line(); name = "Nectarine"; @@ -554,15 +554,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "Cassowary", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } unsigned char VarNectarine = cs_subset_enum(sub, "Nectarine"); - TEST_MSG("String: %s = %d\n", name, VarNectarine); + TEST_MSG("String: %s = %d", name, VarNectarine); short_line(); cs_str_native_set(cs, name, 253, NULL); @@ -570,15 +570,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, ANIMAL_CASSOWARY, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_enum(sub, "Nectarine"); - TEST_MSG("Native: %s = %d\n", name, VarNectarine); + TEST_MSG("Native: %s = %d", name, VarNectarine); log_line(__func__); return true; @@ -589,8 +589,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %ld\n", parent, pval); - TEST_MSG("%15s = %ld\n", child, cval); + TEST_MSG("%15s = %ld", parent, pval); + TEST_MSG("%15s = %ld", child, cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -610,7 +610,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -620,7 +620,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "Dingo", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -631,7 +631,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "Cassowary", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -642,7 +642,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -653,7 +653,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/initial.c b/test/config/initial.c index 065ab9930..d551a50f1 100644 --- a/test/config/initial.c +++ b/test/config/initial.c @@ -54,7 +54,7 @@ static bool test_set_initial(struct ConfigSubset *sub, struct Buffer *err) const char *aval = "pie"; int rc = cs_he_initial_set(cs, he_a, aval, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); name = "Banana"; struct HashElem *he_b = cs_get_elem(cs, name); @@ -80,9 +80,9 @@ static bool test_set_initial(struct ConfigSubset *sub, struct Buffer *err) const char *VarBanana = cs_subset_string(sub, "Banana"); const char *VarCherry = cs_subset_string(sub, "Cherry"); - TEST_MSG("Apple = %s\n", VarApple); - TEST_MSG("Banana = %s\n", VarBanana); - TEST_MSG("Cherry = %s\n", VarCherry); + TEST_MSG("Apple = %s", VarApple); + TEST_MSG("Banana = %s", VarBanana); + TEST_MSG("Cherry = %s", VarCherry); log_line(__func__); return (!mutt_str_equal(VarApple, aval) && !mutt_str_equal(VarBanana, bval) && diff --git a/test/config/long.c b/test/config/long.c index 15964c39d..6c5d3ec1a 100644 --- a/test/config/long.c +++ b/test/config/long.c @@ -62,19 +62,19 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) long VarApple = cs_subset_long(sub, "Apple"); long VarBanana = cs_subset_long(sub, "Banana"); - TEST_MSG("Apple = %ld\n", VarApple); - TEST_MSG("Banana = %ld\n", VarBanana); + TEST_MSG("Apple = %ld", VarApple); + TEST_MSG("Banana = %ld", VarBanana); if (!TEST_CHECK(VarApple == -42)) { - TEST_MSG("Expected: %d\n", -42); - TEST_MSG("Actual : %ld\n", VarApple); + TEST_MSG("Expected: %d", -42); + TEST_MSG("Actual : %ld", VarApple); } if (!TEST_CHECK(VarBanana == 99)) { - TEST_MSG("Expected: %d\n", 99); - TEST_MSG("Actual : %ld\n", VarBanana); + TEST_MSG("Expected: %d", 99); + TEST_MSG("Actual : %ld", VarBanana); } cs_str_string_set(cs, "Apple", "2001", err); @@ -91,41 +91,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "-42")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_long(sub, "Apple"); - TEST_MSG("Apple = %ld\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = %ld", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "99")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } VarBanana = cs_subset_long(sub, "Banana"); - TEST_MSG("Banana = %ld\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = %ld", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "123", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -133,13 +133,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } long VarCherry = cs_subset_long(sub, "Cherry"); - TEST_MSG("Cherry = %ld\n", VarCherry); - TEST_MSG("Cherry's initial value is %s\n", buf_string(value)); + TEST_MSG("Cherry = %ld", VarCherry); + TEST_MSG("Cherry's initial value is %s", buf_string(value)); buf_pool_release(&value); log_line(__func__); @@ -162,45 +162,45 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) { cs_str_native_set(cs, name, -42, NULL); - TEST_MSG("Setting %s to %s\n", name, valid[i]); + TEST_MSG("Setting %s to %s", name, valid[i]); buf_reset(err); rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } VarDamson = cs_subset_long(sub, "Damson"); if (!TEST_CHECK(VarDamson == longs[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %ld, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %ld, set by '%s'", name, VarDamson, valid[i]); short_line(); } for (unsigned int i = 0; i < mutt_array_size(invalid); i++) { - TEST_MSG("Setting %s to %s\n", name, NONULL(invalid[i])); + TEST_MSG("Setting %s to %s", name, NONULL(invalid[i])); buf_reset(err); rc = cs_str_string_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_long(sub, "Damson"); - TEST_MSG("%s = %ld, set by '%s'\n", name, VarDamson, NONULL(invalid[i])); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %ld, set by '%s'", name, VarDamson, NONULL(invalid[i])); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -208,15 +208,15 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) name = "Elderberry"; buf_reset(err); - TEST_MSG("Setting %s to %s\n", name, "-42"); + TEST_MSG("Setting %s to %s", name, "-42"); rc = cs_str_string_set(cs, name, "-42", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -235,22 +235,22 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } short VarFig = cs_subset_long(sub, "Fig"); - TEST_MSG("%s = %ld, %s\n", name, VarFig, buf_string(err)); + TEST_MSG("%s = %ld, %s", name, VarFig, buf_string(err)); cs_str_native_set(cs, name, -789, NULL); buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } VarFig = cs_subset_long(sub, "Fig"); - TEST_MSG("%s = %ld, %s\n", name, VarFig, buf_string(err)); + TEST_MSG("%s = %ld, %s", name, VarFig, buf_string(err)); log_line(__func__); return true; @@ -273,47 +273,47 @@ static bool test_string_plus_equals(struct ConfigSubset *sub, struct Buffer *err cs_str_native_set(cs, name, -42, NULL); VarDamson = cs_subset_long(sub, "Damson"); - TEST_MSG("Increasing %s with initial value %d by %s\n", name, VarDamson, valid[i]); + TEST_MSG("Increasing %s with initial value %d by %s", name, VarDamson, valid[i]); buf_reset(err); rc = cs_str_string_plus_equals(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } VarDamson = cs_subset_long(sub, "Damson"); if (!TEST_CHECK(VarDamson == numbers[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); short_line(); } for (unsigned int i = 0; i < mutt_array_size(invalid); i++) { VarDamson = cs_subset_long(sub, "Damson"); - TEST_MSG("Increasing %s with initial value %d by %s\n", name, VarDamson, + TEST_MSG("Increasing %s with initial value %d by %s", name, VarDamson, NONULL(invalid[i])); buf_reset(err); rc = cs_str_string_plus_equals(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_long(sub, "Damson"); - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -321,15 +321,15 @@ static bool test_string_plus_equals(struct ConfigSubset *sub, struct Buffer *err name = "Elderberry"; buf_reset(err); - TEST_MSG("Increasing %s by %s\n", name, "-42"); + TEST_MSG("Increasing %s by %s", name, "-42"); rc = cs_str_string_plus_equals(cs, name, "-42", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -354,47 +354,47 @@ static bool test_string_minus_equals(struct ConfigSubset *sub, struct Buffer *er cs_str_native_set(cs, name, -42, NULL); VarDamson = cs_subset_long(sub, "Damson"); - TEST_MSG("Decreasing %s with initial value %d by %s\n", name, VarDamson, valid[i]); + TEST_MSG("Decreasing %s with initial value %d by %s", name, VarDamson, valid[i]); buf_reset(err); rc = cs_str_string_minus_equals(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } VarDamson = cs_subset_long(sub, "Damson"); if (!TEST_CHECK(VarDamson == numbers[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); short_line(); } for (unsigned int i = 0; i < mutt_array_size(invalid); i++) { VarDamson = cs_subset_long(sub, "Damson"); - TEST_MSG("Decreasing %s with initial value %d by %s\n", name, VarDamson, + TEST_MSG("Decreasing %s with initial value %d by %s", name, VarDamson, NONULL(invalid[i])); buf_reset(err); rc = cs_str_string_minus_equals(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_long(sub, "Damson"); - TEST_MSG("%s = %d, decreased by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, decreased by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -402,15 +402,15 @@ static bool test_string_minus_equals(struct ConfigSubset *sub, struct Buffer *er name = "Elderberry"; buf_reset(err); - TEST_MSG("Increasing %s by %s\n", name, "42"); + TEST_MSG("Increasing %s by %s", name, "42"); rc = cs_str_string_minus_equals(cs, name, "42", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -425,50 +425,50 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) const char *name = "Guava"; long value = 12345; - TEST_MSG("Setting %s to %ld\n", name, value); + TEST_MSG("Setting %s to %ld", name, value); cs_str_native_set(cs, name, 0, NULL); buf_reset(err); int rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } long VarGuava = cs_subset_long(sub, "Guava"); if (!TEST_CHECK(VarGuava == value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %ld, set to '%ld'\n", name, VarGuava, value); + TEST_MSG("%s = %ld, set to '%ld'", name, VarGuava, value); short_line(); - TEST_MSG("Setting %s to %ld\n", name, value); + TEST_MSG("Setting %s to %ld", name, value); rc = cs_str_native_set(cs, name, value, err); if (TEST_CHECK((rc & CSR_SUC_NO_CHANGE) != 0)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } name = "Hawthorn"; value = -42; short_line(); - TEST_MSG("Setting %s to %ld\n", name, value); + TEST_MSG("Setting %s to %ld", name, value); rc = cs_str_native_set(cs, name, value, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -487,10 +487,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = %ld\n", name, value); + TEST_MSG("%s = %ld", name, value); log_line(__func__); return true; @@ -506,56 +506,56 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); long VarJackfruit = cs_subset_long(sub, "Jackfruit"); - TEST_MSG("%s = %ld\n", name, VarJackfruit); + TEST_MSG("%s = %ld", name, VarJackfruit); int rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarJackfruit = cs_subset_long(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit != 345)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = %ld\n", name, VarJackfruit); + TEST_MSG("Reset: %s = %ld", name, VarJackfruit); short_line(); name = "Kumquat"; buf_reset(err); long VarKumquat = cs_subset_long(sub, "Kumquat"); - TEST_MSG("Initial: %s = %ld\n", name, VarKumquat); + TEST_MSG("Initial: %s = %ld", name, VarKumquat); dont_fail = true; rc = cs_str_string_set(cs, name, "99", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarKumquat = cs_subset_long(sub, "Kumquat"); - TEST_MSG("Set: %s = %ld\n", name, VarKumquat); + TEST_MSG("Set: %s = %ld", name, VarKumquat); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarKumquat = cs_subset_long(sub, "Kumquat"); if (!TEST_CHECK(VarKumquat == 99)) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = %ld\n", name, VarKumquat); + TEST_MSG("Reset: %s = %ld", name, VarKumquat); log_line(__func__); return true; @@ -572,15 +572,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "456", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } long VarLemon = cs_subset_long(sub, "Lemon"); - TEST_MSG("String: %s = %ld\n", name, VarLemon); + TEST_MSG("String: %s = %ld", name, VarLemon); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -588,15 +588,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 123, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_long(sub, "Lemon"); - TEST_MSG("Native: %s = %ld\n", name, VarLemon); + TEST_MSG("Native: %s = %ld", name, VarLemon); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -604,16 +604,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_plus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_long(sub, "Lemon"); TEST_CHECK(VarLemon == 579); - TEST_MSG("PlusEquals: %s = %d\n", name, VarLemon); + TEST_MSG("PlusEquals: %s = %d", name, VarLemon); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -621,16 +621,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_minus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_long(sub, "Lemon"); TEST_CHECK(VarLemon == 333); - TEST_MSG("MinusEquals: %s = %d\n", name, VarLemon); + TEST_MSG("MinusEquals: %s = %d", name, VarLemon); short_line(); name = "Mango"; @@ -639,15 +639,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "456", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } long VarMango = cs_subset_long(sub, "Mango"); - TEST_MSG("String: %s = %ld\n", name, VarMango); + TEST_MSG("String: %s = %ld", name, VarMango); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -655,15 +655,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 123, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarMango = cs_subset_long(sub, "Mango"); - TEST_MSG("Native: %s = %ld\n", name, VarMango); + TEST_MSG("Native: %s = %ld", name, VarMango); short_line(); name = "Nectarine"; @@ -674,15 +674,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "456", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } long VarNectarine = cs_subset_long(sub, "Nectarine"); - TEST_MSG("String: %s = %ld\n", name, VarNectarine); + TEST_MSG("String: %s = %ld", name, VarNectarine); short_line(); dont_fail = true; @@ -692,15 +692,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 123, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_long(sub, "Nectarine"); - TEST_MSG("Native: %s = %ld\n", name, VarNectarine); + TEST_MSG("Native: %s = %ld", name, VarNectarine); short_line(); dont_fail = true; @@ -710,16 +710,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_plus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_long(sub, "Nectarine"); TEST_CHECK(VarNectarine == 456); - TEST_MSG("PlusEquals: %s = %d\n", name, VarNectarine); + TEST_MSG("PlusEquals: %s = %d", name, VarNectarine); short_line(); dont_fail = true; @@ -729,16 +729,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_minus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_long(sub, "Nectarine"); TEST_CHECK(VarNectarine == 456); - TEST_MSG("MinusEquals: %s = %d\n", name, VarNectarine); + TEST_MSG("MinusEquals: %s = %d", name, VarNectarine); log_line(__func__); return true; @@ -749,8 +749,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %ld\n", parent, pval); - TEST_MSG("%15s = %ld\n", child, cval); + TEST_MSG("%15s = %ld", parent, pval); + TEST_MSG("%15s = %ld", child, cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -770,7 +770,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -780,7 +780,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "456", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -791,7 +791,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "-99", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -802,7 +802,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -813,7 +813,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/mbtable.c b/test/config/mbtable.c index 886987c65..f36702b4d 100644 --- a/test/config/mbtable.c +++ b/test/config/mbtable.c @@ -63,18 +63,18 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) struct MbTable *VarApple = cs_subset_mbtable(sub, "Apple"); struct MbTable *VarBanana = cs_subset_mbtable(sub, "Banana"); - TEST_MSG("Apple = %s\n", VarApple->orig_str); - TEST_MSG("Banana = %s\n", VarBanana->orig_str); + TEST_MSG("Apple = %s", VarApple->orig_str); + TEST_MSG("Banana = %s", VarBanana->orig_str); if (!TEST_CHECK_STR_EQ(VarApple->orig_str, "apple")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } if (!TEST_CHECK_STR_EQ(VarBanana->orig_str, "banana")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } @@ -92,41 +92,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "apple")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_mbtable(sub, "Apple"); - TEST_MSG("Apple = '%s'\n", VarApple ? VarApple->orig_str : ""); - TEST_MSG("Apple's initial value is %s\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple ? VarApple->orig_str : ""); + TEST_MSG("Apple's initial value is %s", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "banana")) { - TEST_MSG("Banana's initial value is wrong: %s\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: %s", buf_string(value)); return false; } VarBanana = cs_subset_mbtable(sub, "Banana"); - TEST_MSG("Banana = '%s'\n", VarBanana ? VarBanana->orig_str : ""); - TEST_MSG("Banana's initial value is %s\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana ? VarBanana->orig_str : ""); + TEST_MSG("Banana's initial value is %s", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "config.*", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -134,7 +134,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "file.*", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -142,13 +142,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } struct MbTable *VarCherry = cs_subset_mbtable(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry->orig_str); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry->orig_str); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -171,13 +171,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } @@ -185,10 +185,10 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) mb = VarDamson ? VarDamson->orig_str : NULL; if (!TEST_CHECK_STR_EQ(mb, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(mb), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(mb), NONULL(valid[i])); } name = "Elderberry"; @@ -198,13 +198,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } @@ -212,17 +212,17 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) const char *orig_str = VarElderberry ? VarElderberry->orig_str : NULL; if (!TEST_CHECK_STR_EQ(orig_str, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(orig_str), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(orig_str), NONULL(valid[i])); } buf_reset(err); rc = cs_str_string_set(cs, name, "\377", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -241,24 +241,24 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } struct MbTable *VarFig = cs_subset_mbtable(sub, "Fig"); mb = VarFig ? VarFig->orig_str : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(mb), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(mb), buf_string(err)); name = "Guava"; buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } struct MbTable *VarGuava = cs_subset_mbtable(sub, "Guava"); mb = VarGuava ? VarGuava->orig_str : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(mb), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(mb), buf_string(err)); name = "Hawthorn"; rc = cs_str_string_set(cs, name, "hawthorn", err); @@ -269,12 +269,12 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } struct MbTable *VarHawthorn = cs_subset_mbtable(sub, "Hawthorn"); mb = VarHawthorn ? VarHawthorn->orig_str : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(mb), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(mb), buf_string(err)); log_line(__func__); return true; @@ -294,7 +294,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_native_set(cs, name, (intptr_t) t, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tns_out; } @@ -302,28 +302,28 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) mb = VarIlama ? VarIlama->orig_str : NULL; if (!TEST_CHECK_STR_EQ(mb, t->orig_str)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tns_out; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(mb), t->orig_str); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(mb), t->orig_str); name = "Jackfruit"; buf_reset(err); rc = cs_str_native_set(cs, name, 0, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tns_out; } struct MbTable *VarJackfruit = cs_subset_mbtable(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit == NULL)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tns_out; } mb = VarJackfruit ? VarJackfruit->orig_str : NULL; - TEST_MSG("%s = '%s', set by NULL\n", name, NONULL(mb)); + TEST_MSG("%s = '%s', set by NULL", name, NONULL(mb)); result = true; tns_out: @@ -349,12 +349,12 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) struct MbTable *VarKumquat = cs_subset_mbtable(sub, "Kumquat"); if (!TEST_CHECK(VarKumquat == t)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } char *mb1 = VarKumquat ? VarKumquat->orig_str : NULL; char *mb2 = t ? t->orig_str : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(mb1), NONULL(mb2)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(mb1), NONULL(mb2)); log_line(__func__); return true; @@ -371,18 +371,18 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) struct MbTable *VarLemon = cs_subset_mbtable(sub, "Lemon"); char *mb = VarLemon ? VarLemon->orig_str : NULL; - TEST_MSG("Initial: %s = '%s'\n", name, NONULL(mb)); + TEST_MSG("Initial: %s = '%s'", name, NONULL(mb)); int rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarLemon = cs_subset_mbtable(sub, "Lemon"); mb = VarLemon ? VarLemon->orig_str : NULL; - TEST_MSG("Set: %s = '%s'\n", name, NONULL(mb)); + TEST_MSG("Set: %s = '%s'", name, NONULL(mb)); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -390,44 +390,44 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) mb = VarLemon ? VarLemon->orig_str : NULL; if (!TEST_CHECK_STR_EQ(mb, "lemon")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, NONULL(mb)); + TEST_MSG("Reset: %s = '%s'", name, NONULL(mb)); name = "Mango"; buf_reset(err); struct MbTable *VarMango = cs_subset_mbtable(sub, "Mango"); - TEST_MSG("Initial: %s = '%s'\n", name, VarMango->orig_str); + TEST_MSG("Initial: %s = '%s'", name, VarMango->orig_str); dont_fail = true; rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarMango = cs_subset_mbtable(sub, "Mango"); - TEST_MSG("Set: %s = '%s'\n", name, VarMango->orig_str); + TEST_MSG("Set: %s = '%s'", name, VarMango->orig_str); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarMango = cs_subset_mbtable(sub, "Mango"); if (!TEST_CHECK_STR_EQ(VarMango->orig_str, "hello")) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, VarMango->orig_str); + TEST_MSG("Reset: %s = '%s'", name, VarMango->orig_str); log_line(__func__); return true; @@ -447,93 +447,93 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } struct MbTable *VarNectarine = cs_subset_mbtable(sub, "Nectarine"); mb = VarNectarine ? VarNectarine->orig_str : NULL; - TEST_MSG("MbTable: %s = %s\n", name, NONULL(mb)); + TEST_MSG("MbTable: %s = %s", name, NONULL(mb)); buf_reset(err); rc = cs_str_native_set(cs, name, IP t, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarNectarine = cs_subset_mbtable(sub, "Nectarine"); mb = VarNectarine ? VarNectarine->orig_str : NULL; - TEST_MSG("Native: %s = %s\n", name, NONULL(mb)); + TEST_MSG("Native: %s = %s", name, NONULL(mb)); name = "Olive"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } struct MbTable *VarOlive = cs_subset_mbtable(sub, "Olive"); mb = VarOlive ? VarOlive->orig_str : NULL; - TEST_MSG("MbTable: %s = %s\n", name, NONULL(mb)); + TEST_MSG("MbTable: %s = %s", name, NONULL(mb)); buf_reset(err); rc = cs_str_native_set(cs, name, IP t, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarOlive = cs_subset_mbtable(sub, "Olive"); mb = VarOlive ? VarOlive->orig_str : NULL; - TEST_MSG("Native: %s = %s\n", name, NONULL(mb)); + TEST_MSG("Native: %s = %s", name, NONULL(mb)); name = "Papaya"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } struct MbTable *VarPapaya = cs_subset_mbtable(sub, "Papaya"); mb = VarPapaya ? VarPapaya->orig_str : NULL; - TEST_MSG("MbTable: %s = %s\n", name, NONULL(mb)); + TEST_MSG("MbTable: %s = %s", name, NONULL(mb)); buf_reset(err); rc = cs_str_native_set(cs, name, IP t, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarPapaya = cs_subset_mbtable(sub, "Papaya"); mb = VarPapaya ? VarPapaya->orig_str : NULL; - TEST_MSG("Native: %s = %s\n", name, NONULL(mb)); + TEST_MSG("Native: %s = %s", name, NONULL(mb)); log_line(__func__); result = true; @@ -553,8 +553,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch char *pstr = pa ? pa->orig_str : NULL; char *cstr = ca ? ca->orig_str : NULL; - TEST_MSG("%15s = %s\n", parent, NONULL(pstr)); - TEST_MSG("%15s = %s\n", child, NONULL(cstr)); + TEST_MSG("%15s = %s", parent, NONULL(pstr)); + TEST_MSG("%15s = %s", child, NONULL(cstr)); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -574,7 +574,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -583,7 +583,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -593,7 +593,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "world", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -603,7 +603,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -613,7 +613,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/myvar.c b/test/config/myvar.c index 9374a90f4..66b59f569 100644 --- a/test/config/myvar.c +++ b/test/config/myvar.c @@ -84,13 +84,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) if (!TEST_CHECK(mutt_str_equal(VarApple, "apple"))) { - TEST_MSG("Error: initial values were wrong: Apple = %s\n", VarApple); + TEST_MSG("Error: initial values were wrong: Apple = %s", VarApple); return false; } if (!TEST_CHECK(mutt_str_equal(VarBanana, "banana"))) { - TEST_MSG("Error: initial values were wrong: Banana = %s\n", VarBanana); + TEST_MSG("Error: initial values were wrong: Banana = %s", VarBanana); return false; } @@ -108,41 +108,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } VarApple = cs_subset_myvar(sub, "Apple"); if (!TEST_CHECK(mutt_str_equal(buf_string(value), "apple"))) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Apple = '%s'\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } VarBanana = cs_subset_myvar(sub, "Banana"); if (!TEST_CHECK(mutt_str_equal(buf_string(value), "banana"))) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Banana = '%s'\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "train", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -150,7 +150,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "plane", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -158,13 +158,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } const char *VarCherry = cs_subset_myvar(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -186,23 +186,23 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarDamson = cs_subset_myvar(sub, "Damson"); if (!TEST_CHECK(mutt_str_equal(VarDamson, valid[i]))) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarDamson), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarDamson), NONULL(valid[i])); short_line(); } @@ -211,7 +211,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -223,23 +223,23 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarElderberry = cs_subset_myvar(sub, "Elderberry"); if (!TEST_CHECK(mutt_str_equal(VarElderberry, valid[i]))) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarElderberry), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarElderberry), NONULL(valid[i])); } log_line(__func__); @@ -256,22 +256,22 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarGuava = cs_subset_myvar(sub, "Guava"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarGuava), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarGuava), buf_string(err)); name = "Hawthorn"; buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarHawthorn = cs_subset_myvar(sub, "Hawthorn"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarHawthorn), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarHawthorn), buf_string(err)); name = "Ilama"; rc = cs_str_string_set(cs, name, "ilama", err); @@ -282,11 +282,11 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarIlama = cs_subset_myvar(sub, "Ilama"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarIlama), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarIlama), buf_string(err)); log_line(__func__); return true; @@ -307,23 +307,23 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarJackfruit = cs_subset_myvar(sub, "Jackfruit"); if (!TEST_CHECK(mutt_str_equal(VarJackfruit, valid[i]))) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarJackfruit), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarJackfruit), NONULL(valid[i])); short_line(); } @@ -332,7 +332,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) "", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -344,23 +344,23 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarKumquat = cs_subset_myvar(sub, "Kumquat"); if (!TEST_CHECK(mutt_str_equal(VarKumquat, valid[i]))) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarKumquat), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarKumquat), NONULL(valid[i])); } log_line(__func__); @@ -382,10 +382,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK(mutt_str_equal(VarMango, (char *) value))) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = '%s', '%s'\n", name, VarMango, (char *) value); + TEST_MSG("%s = '%s', '%s'", name, VarMango, (char *) value); log_line(__func__); return true; @@ -419,28 +419,28 @@ static bool test_string_plus_equals(struct ConfigSubset *sub, struct Buffer *err rc = cs_str_string_set(cs, name, PlusTests[i][0], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Set failed: %s\n", buf_string(err)); + TEST_MSG("Set failed: %s", buf_string(err)); return false; } rc = cs_str_string_plus_equals(cs, name, PlusTests[i][1], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("PlusEquals failed: %s\n", buf_string(err)); + TEST_MSG("PlusEquals failed: %s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } if (!TEST_CHECK(mutt_str_equal(PlusTests[i][2], buf_string(err)))) { - TEST_MSG("Expected: %s\n", PlusTests[i][2]); - TEST_MSG("Actual : %s\n", buf_string(err)); + TEST_MSG("Expected: %s", PlusTests[i][2]); + TEST_MSG("Actual : %s", buf_string(err)); return false; } } @@ -461,7 +461,7 @@ static bool test_non_existing(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, "does_not_exist", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Get succeeded but should have failed: %s\n", buf_string(err)); + TEST_MSG("Get succeeded but should have failed: %s", buf_string(err)); return false; } @@ -470,20 +470,20 @@ static bool test_non_existing(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Set failed: %s\n", buf_string(err)); + TEST_MSG("Set failed: %s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); buf_reset(err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } if (!TEST_CHECK(mutt_str_equal("", buf_string(err)))) { - TEST_MSG("Expected: '%s'\n", ""); - TEST_MSG("Actual : '%s'\n", buf_string(err)); + TEST_MSG("Expected: '%s'", ""); + TEST_MSG("Actual : '%s'", buf_string(err)); return false; } @@ -492,14 +492,14 @@ static bool test_non_existing(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_delete(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Delete failed: %s\n", buf_string(err)); + TEST_MSG("Delete failed: %s", buf_string(err)); return false; } buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Get succeeded but should have failed: %s\n", buf_string(err)); + TEST_MSG("Get succeeded but should have failed: %s", buf_string(err)); return false; } @@ -516,17 +516,17 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const char *VarNectarine = cs_subset_myvar(sub, "Nectarine"); - TEST_MSG("Initial: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Initial: %s = '%s'", name, VarNectarine); int rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarNectarine = cs_subset_myvar(sub, "Nectarine"); - TEST_MSG("Set: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Set: %s = '%s'", name, VarNectarine); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -534,12 +534,12 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } if (!TEST_CHECK(mutt_str_equal(buf_string(err), "nectarine"))) { - TEST_MSG("Reset failed: expected = %s, got = %s\n", "nectarine", buf_string(err)); + TEST_MSG("Reset failed: expected = %s, got = %s", "nectarine", buf_string(err)); return false; } @@ -547,17 +547,17 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const char *VarOlive = cs_subset_myvar(sub, "Olive"); - TEST_MSG("Initial: %s = '%s'\n", name, VarOlive); + TEST_MSG("Initial: %s = '%s'", name, VarOlive); rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarOlive = cs_subset_myvar(sub, "Olive"); - TEST_MSG("Set: %s = '%s'\n", name, VarOlive); + TEST_MSG("Set: %s = '%s'", name, VarOlive); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -583,7 +583,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (he) { - TEST_MSG("Error: Inheritance succeeded but should have failed.\n", buf_string(err)); + TEST_MSG("Error: Inheritance succeeded but should have failed.", buf_string(err)); goto ti_out; } diff --git a/test/config/number.c b/test/config/number.c index 06e227c2a..38262e8bd 100644 --- a/test/config/number.c +++ b/test/config/number.c @@ -62,19 +62,19 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) short VarApple = cs_subset_number(sub, "Apple"); short VarBanana = cs_subset_number(sub, "Banana"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Banana = %d\n", VarBanana); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Banana = %d", VarBanana); if (!TEST_CHECK(VarApple == -42)) { - TEST_MSG("Expected: %d\n", -42); - TEST_MSG("Actual : %d\n", VarApple); + TEST_MSG("Expected: %d", -42); + TEST_MSG("Actual : %d", VarApple); } if (!TEST_CHECK(VarBanana == 99)) { - TEST_MSG("Expected: %d\n", 99); - TEST_MSG("Actual : %d\n", VarBanana); + TEST_MSG("Expected: %d", 99); + TEST_MSG("Actual : %d", VarBanana); } cs_str_string_set(cs, "Apple", "2001", err); @@ -91,41 +91,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "-42")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_number(sub, "Apple"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "99")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } VarBanana = cs_subset_number(sub, "Banana"); - TEST_MSG("Banana = %d\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = %d", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "123", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -133,13 +133,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } short VarCherry = cs_subset_number(sub, "Cherry"); - TEST_MSG("Cherry = %d\n", VarCherry); - TEST_MSG("Cherry's initial value is %s\n", buf_string(value)); + TEST_MSG("Cherry = %d", VarCherry); + TEST_MSG("Cherry's initial value is %s", buf_string(value)); buf_pool_release(&value); log_line(__func__); @@ -162,45 +162,45 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) { cs_str_native_set(cs, name, -42, NULL); - TEST_MSG("Setting %s to %s\n", name, valid[i]); + TEST_MSG("Setting %s to %s", name, valid[i]); buf_reset(err); rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } VarDamson = cs_subset_number(sub, "Damson"); if (!TEST_CHECK(VarDamson == numbers[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); short_line(); } for (unsigned int i = 0; i < mutt_array_size(invalid); i++) { - TEST_MSG("Setting %s to %s\n", name, NONULL(invalid[i])); + TEST_MSG("Setting %s to %s", name, NONULL(invalid[i])); buf_reset(err); rc = cs_str_string_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_number(sub, "Damson"); - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -208,15 +208,15 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) name = "Elderberry"; buf_reset(err); - TEST_MSG("Setting %s to %s\n", name, "-42"); + TEST_MSG("Setting %s to %s", name, "-42"); rc = cs_str_string_set(cs, name, "-42", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -235,22 +235,22 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } short VarFig = cs_subset_number(sub, "Fig"); - TEST_MSG("%s = %d, %s\n", name, VarFig, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarFig, buf_string(err)); cs_str_native_set(cs, name, -789, NULL); buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } VarFig = cs_subset_number(sub, "Fig"); - TEST_MSG("%s = %d, %s\n", name, VarFig, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarFig, buf_string(err)); log_line(__func__); return true; @@ -263,50 +263,50 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) const char *name = "Guava"; short value = 12345; - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); cs_str_native_set(cs, name, 0, NULL); buf_reset(err); int rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarGuava = cs_subset_number(sub, "Guava"); if (!TEST_CHECK(VarGuava == value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set to '%d'\n", name, VarGuava, value); + TEST_MSG("%s = %d, set to '%d'", name, VarGuava, value); short_line(); - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); rc = cs_str_native_set(cs, name, value, err); if (TEST_CHECK((rc & CSR_SUC_NO_CHANGE) != 0)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } name = "Hawthorn"; value = -42; short_line(); - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); rc = cs_str_native_set(cs, name, value, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -315,18 +315,18 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) { short_line(); cs_str_native_set(cs, name, 123, NULL); - TEST_MSG("Setting %s to %d\n", name, invalid[i]); + TEST_MSG("Setting %s to %d", name, invalid[i]); buf_reset(err); rc = cs_str_native_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarGuava = cs_subset_number(sub, "Guava"); - TEST_MSG("%s = %d, set by '%d'\n", name, VarGuava, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%d'", name, VarGuava, invalid[i]); + TEST_MSG("This test should have failed"); return false; } } @@ -346,10 +346,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = %ld\n", name, value); + TEST_MSG("%s = %ld", name, value); log_line(__func__); return true; @@ -372,47 +372,47 @@ static bool test_string_plus_equals(struct ConfigSubset *sub, struct Buffer *err cs_str_native_set(cs, name, -42, NULL); VarDamson = cs_subset_number(sub, "Damson"); - TEST_MSG("Increasing %s with initial value %d by %s\n", name, VarDamson, valid[i]); + TEST_MSG("Increasing %s with initial value %d by %s", name, VarDamson, valid[i]); buf_reset(err); rc = cs_str_string_plus_equals(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } VarDamson = cs_subset_number(sub, "Damson"); if (!TEST_CHECK(VarDamson == numbers[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); short_line(); } for (unsigned int i = 0; i < mutt_array_size(invalid); i++) { VarDamson = cs_subset_number(sub, "Damson"); - TEST_MSG("Increasing %s with initial value %d by %s\n", name, VarDamson, + TEST_MSG("Increasing %s with initial value %d by %s", name, VarDamson, NONULL(invalid[i])); buf_reset(err); rc = cs_str_string_plus_equals(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_number(sub, "Damson"); - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -420,15 +420,15 @@ static bool test_string_plus_equals(struct ConfigSubset *sub, struct Buffer *err name = "Elderberry"; buf_reset(err); - TEST_MSG("Increasing %s by %s\n", name, "-42"); + TEST_MSG("Increasing %s by %s", name, "-42"); rc = cs_str_string_plus_equals(cs, name, "-42", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -453,47 +453,47 @@ static bool test_string_minus_equals(struct ConfigSubset *sub, struct Buffer *er cs_str_native_set(cs, name, -42, NULL); VarDamson = cs_subset_number(sub, "Damson"); - TEST_MSG("Decreasing %s with initial value %d by %s\n", name, VarDamson, valid[i]); + TEST_MSG("Decreasing %s with initial value %d by %s", name, VarDamson, valid[i]); buf_reset(err); rc = cs_str_string_minus_equals(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } VarDamson = cs_subset_number(sub, "Damson"); if (!TEST_CHECK(VarDamson == numbers[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); short_line(); } for (unsigned int i = 0; i < mutt_array_size(invalid); i++) { VarDamson = cs_subset_number(sub, "Damson"); - TEST_MSG("Decreasing %s with initial value %d by %s\n", name, VarDamson, + TEST_MSG("Decreasing %s with initial value %d by %s", name, VarDamson, NONULL(invalid[i])); buf_reset(err); rc = cs_str_string_minus_equals(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_number(sub, "Damson"); - TEST_MSG("%s = %d, decreased by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, decreased by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -501,15 +501,15 @@ static bool test_string_minus_equals(struct ConfigSubset *sub, struct Buffer *er name = "Elderberry"; buf_reset(err); - TEST_MSG("Increasing %s by %s\n", name, "42"); + TEST_MSG("Increasing %s by %s", name, "42"); rc = cs_str_string_minus_equals(cs, name, "42", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return false; } @@ -527,56 +527,56 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); short VarJackfruit = cs_subset_number(sub, "Jackfruit"); - TEST_MSG("%s = %d\n", name, VarJackfruit); + TEST_MSG("%s = %d", name, VarJackfruit); int rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarJackfruit = cs_subset_number(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit != 345)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarJackfruit); + TEST_MSG("Reset: %s = %d", name, VarJackfruit); short_line(); name = "Kumquat"; buf_reset(err); short VarKumquat = cs_subset_number(sub, "Kumquat"); - TEST_MSG("Initial: %s = %d\n", name, VarKumquat); + TEST_MSG("Initial: %s = %d", name, VarKumquat); dont_fail = true; rc = cs_str_string_set(cs, name, "99", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarKumquat = cs_subset_number(sub, "Kumquat"); - TEST_MSG("Set: %s = %d\n", name, VarKumquat); + TEST_MSG("Set: %s = %d", name, VarKumquat); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarKumquat = cs_subset_number(sub, "Kumquat"); if (!TEST_CHECK(VarKumquat == 99)) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarKumquat); + TEST_MSG("Reset: %s = %d", name, VarKumquat); log_line(__func__); return true; @@ -593,15 +593,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "456", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarLemon = cs_subset_number(sub, "Lemon"); - TEST_MSG("String: %s = %d\n", name, VarLemon); + TEST_MSG("String: %s = %d", name, VarLemon); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -609,15 +609,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 123, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_number(sub, "Lemon"); - TEST_MSG("Native: %s = %d\n", name, VarLemon); + TEST_MSG("Native: %s = %d", name, VarLemon); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -625,16 +625,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_plus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_number(sub, "Lemon"); TEST_CHECK(VarLemon == 579); - TEST_MSG("PlusEquals: %s = %d\n", name, VarLemon); + TEST_MSG("PlusEquals: %s = %d", name, VarLemon); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -642,16 +642,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_minus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_number(sub, "Lemon"); TEST_CHECK(VarLemon == 333); - TEST_MSG("MinusEquals: %s = %d\n", name, VarLemon); + TEST_MSG("MinusEquals: %s = %d", name, VarLemon); short_line(); name = "Mango"; @@ -660,15 +660,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "456", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarMango = cs_subset_number(sub, "Mango"); - TEST_MSG("String: %s = %d\n", name, VarMango); + TEST_MSG("String: %s = %d", name, VarMango); short_line(); cs_str_native_set(cs, name, 456, NULL); @@ -676,15 +676,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 123, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarMango = cs_subset_number(sub, "Mango"); - TEST_MSG("Native: %s = %d\n", name, VarMango); + TEST_MSG("Native: %s = %d", name, VarMango); short_line(); name = "Nectarine"; @@ -695,15 +695,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "456", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarNectarine = cs_subset_number(sub, "Nectarine"); - TEST_MSG("String: %s = %d\n", name, VarNectarine); + TEST_MSG("String: %s = %d", name, VarNectarine); short_line(); struct HashElem *he = cs_get_elem(cs, name); @@ -712,15 +712,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_he_native_set(cs, he, 456, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_number(sub, "Nectarine"); - TEST_MSG("String: %s = %d\n", name, VarNectarine); + TEST_MSG("String: %s = %d", name, VarNectarine); short_line(); dont_fail = true; @@ -730,15 +730,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 123, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_number(sub, "Nectarine"); - TEST_MSG("Native: %s = %d\n", name, VarNectarine); + TEST_MSG("Native: %s = %d", name, VarNectarine); short_line(); dont_fail = true; @@ -748,16 +748,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_plus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_number(sub, "Nectarine"); TEST_CHECK(VarNectarine == 456); - TEST_MSG("PlusEquals: %s = %d\n", name, VarNectarine); + TEST_MSG("PlusEquals: %s = %d", name, VarNectarine); short_line(); dont_fail = true; @@ -767,16 +767,16 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_minus_equals(cs, name, "123", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_number(sub, "Nectarine"); TEST_CHECK(VarNectarine == 456); - TEST_MSG("MinusEquals: %s = %d\n", name, VarNectarine); + TEST_MSG("MinusEquals: %s = %d", name, VarNectarine); log_line(__func__); return true; @@ -787,8 +787,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %ld\n", parent, pval); - TEST_MSG("%15s = %ld\n", child, cval); + TEST_MSG("%15s = %ld", parent, pval); + TEST_MSG("%15s = %ld", child, cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -808,7 +808,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -818,7 +818,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "456", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -829,7 +829,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "-99", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -840,7 +840,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -851,7 +851,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -863,7 +863,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_plus_equals(cs, parent, "456", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -874,7 +874,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_plus_equals(cs, child, "-99", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -886,7 +886,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_minus_equals(cs, parent, "456", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -897,7 +897,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_minus_equals(cs, child, "-99", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/path.c b/test/config/path.c index 92e69fc21..0d3b4aee5 100644 --- a/test/config/path.c +++ b/test/config/path.c @@ -65,18 +65,18 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const char *VarApple = cs_subset_path(sub, "Apple"); const char *VarBanana = cs_subset_path(sub, "Banana"); - TEST_MSG("Apple = %s\n", VarApple); - TEST_MSG("Banana = %s\n", VarBanana); + TEST_MSG("Apple = %s", VarApple); + TEST_MSG("Banana = %s", VarBanana); if (!TEST_CHECK_STR_EQ(VarApple, "apple")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } if (!TEST_CHECK_STR_EQ(VarBanana, "banana")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } @@ -94,41 +94,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } VarApple = cs_subset_path(sub, "Apple"); if (!TEST_CHECK_STR_EQ(buf_string(value), "apple")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Apple = '%s'\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } VarBanana = cs_subset_path(sub, "Banana"); if (!TEST_CHECK_STR_EQ(buf_string(value), "banana")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Banana = '%s'\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", (const char *) Vars[2].initial, value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -136,7 +136,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "train", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -144,7 +144,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "plane", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -152,13 +152,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } const char *VarCherry = cs_subset_path(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -180,23 +180,23 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarDamson = cs_subset_path(sub, "Damson"); if (!TEST_CHECK_STR_EQ(VarDamson, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarDamson), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarDamson), NONULL(valid[i])); short_line(); } @@ -205,11 +205,11 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -221,23 +221,23 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarElderberry = cs_subset_path(sub, "Elderberry"); if (!TEST_CHECK_STR_EQ(VarElderberry, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarElderberry), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarElderberry), NONULL(valid[i])); } log_line(__func__); @@ -254,22 +254,22 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarGuava = cs_subset_path(sub, "Guava"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarGuava), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarGuava), buf_string(err)); name = "Hawthorn"; buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarHawthorn = cs_subset_path(sub, "Hawthorn"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarHawthorn), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarHawthorn), buf_string(err)); name = "Ilama"; rc = cs_str_string_set(cs, name, "ilama", err); @@ -280,11 +280,11 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarIlama = cs_subset_path(sub, "Ilama"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarIlama), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarIlama), buf_string(err)); log_line(__func__); return true; @@ -305,23 +305,23 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarJackfruit = cs_subset_path(sub, "Jackfruit"); if (!TEST_CHECK_STR_EQ(VarJackfruit, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarJackfruit), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarJackfruit), NONULL(valid[i])); short_line(); } @@ -330,11 +330,11 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) "", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -346,23 +346,23 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarKumquat = cs_subset_path(sub, "Kumquat"); if (!TEST_CHECK_STR_EQ(VarKumquat, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarKumquat), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarKumquat), NONULL(valid[i])); } log_line(__func__); @@ -384,10 +384,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK_STR_EQ(VarMango, (char *) value)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = '%s', '%s'\n", name, VarMango, (char *) value); + TEST_MSG("%s = '%s', '%s'", name, VarMango, (char *) value); log_line(__func__); return true; @@ -402,33 +402,33 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const char *VarNectarine = cs_subset_path(sub, "Nectarine"); - TEST_MSG("Initial: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Initial: %s = '%s'", name, VarNectarine); int rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarNectarine = cs_subset_path(sub, "Nectarine"); - TEST_MSG("Set: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Set: %s = '%s'", name, VarNectarine); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_path(sub, "Nectarine"); if (!TEST_CHECK_STR_EQ(VarNectarine, "nectarine")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Reset: %s = '%s'", name, VarNectarine); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -436,34 +436,34 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const char *VarOlive = cs_subset_path(sub, "Olive"); - TEST_MSG("Initial: %s = '%s'\n", name, VarOlive); + TEST_MSG("Initial: %s = '%s'", name, VarOlive); dont_fail = true; rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarOlive = cs_subset_path(sub, "Olive"); - TEST_MSG("Set: %s = '%s'\n", name, VarOlive); + TEST_MSG("Set: %s = '%s'", name, VarOlive); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarOlive = cs_subset_path(sub, "Olive"); if (!TEST_CHECK_STR_EQ(VarOlive, "hello")) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, VarOlive); + TEST_MSG("Reset: %s = '%s'", name, VarOlive); log_line(__func__); return true; @@ -479,87 +479,87 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarPapaya = cs_subset_path(sub, "Papaya"); - TEST_MSG("Path: %s = %s\n", name, VarPapaya); + TEST_MSG("Path: %s = %s", name, VarPapaya); buf_reset(err); rc = cs_str_native_set(cs, name, IP "world", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarPapaya = cs_subset_path(sub, "Papaya"); - TEST_MSG("Native: %s = %s\n", name, VarPapaya); + TEST_MSG("Native: %s = %s", name, VarPapaya); name = "Quince"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarQuince = cs_subset_path(sub, "Quince"); - TEST_MSG("Path: %s = %s\n", name, VarQuince); + TEST_MSG("Path: %s = %s", name, VarQuince); buf_reset(err); rc = cs_str_native_set(cs, name, IP "world", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarQuince = cs_subset_path(sub, "Quince"); - TEST_MSG("Native: %s = %s\n", name, VarQuince); + TEST_MSG("Native: %s = %s", name, VarQuince); name = "Raspberry"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarRaspberry = cs_subset_path(sub, "Raspberry"); - TEST_MSG("Path: %s = %s\n", name, VarRaspberry); + TEST_MSG("Path: %s = %s", name, VarRaspberry); buf_reset(err); rc = cs_str_native_set(cs, name, IP "world", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarRaspberry = cs_subset_path(sub, "Raspberry"); - TEST_MSG("Native: %s = %s\n", name, VarRaspberry); + TEST_MSG("Native: %s = %s", name, VarRaspberry); log_line(__func__); return true; @@ -570,8 +570,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %s\n", parent, (char *) pval); - TEST_MSG("%15s = %s\n", child, (char *) cval); + TEST_MSG("%15s = %s", parent, (char *) pval); + TEST_MSG("%15s = %s", child, (char *) cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -591,7 +591,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -600,7 +600,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "hello", err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -610,7 +610,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "world", err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -620,7 +620,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -630,7 +630,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/quad.c b/test/config/quad.c index d7fd69196..b2da85152 100644 --- a/test/config/quad.c +++ b/test/config/quad.c @@ -63,19 +63,19 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) char VarApple = cs_subset_quad(sub, "Apple"); char VarBanana = cs_subset_quad(sub, "Banana"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Banana = %d\n", VarBanana); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Banana = %d", VarBanana); if (!TEST_CHECK(VarApple == 0)) { - TEST_MSG("Expected: %d\n", 0); - TEST_MSG("Actual : %d\n", VarApple); + TEST_MSG("Expected: %d", 0); + TEST_MSG("Actual : %d", VarApple); } if (!TEST_CHECK(VarBanana == 3)) { - TEST_MSG("Expected: %d\n", 3); - TEST_MSG("Actual : %d\n", VarBanana); + TEST_MSG("Expected: %d", 3); + TEST_MSG("Actual : %d", VarBanana); } cs_str_string_set(cs, "Apple", "ask-yes", err); @@ -89,43 +89,43 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "no")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_quad(sub, "Apple"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "ask-yes")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } VarBanana = cs_subset_quad(sub, "Banana"); - TEST_MSG("Banana = %d\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = %d", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "ask-yes", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -133,13 +133,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } char VarCherry = cs_subset_quad(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry ? "yes" : "no"); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry ? "yes" : "no"); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -167,22 +167,22 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) { cs_str_native_set(cs, name, ((i + 1) % 4), NULL); - TEST_MSG("Setting %s to %s\n", name, valid[i]); + TEST_MSG("Setting %s to %s", name, valid[i]); buf_reset(err); rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarDamson = cs_subset_quad(sub, "Damson"); if (VarDamson == ((i + 1) % 4)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, valid[i]); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, valid[i]); if (i == 2) { @@ -190,13 +190,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } } @@ -209,13 +209,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarDamson = cs_subset_quad(sub, "Damson"); - TEST_MSG("%s = %d, set by '%s'\n", name, VarDamson, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name, VarDamson, invalid[i]); + TEST_MSG("This test should have failed"); return false; } short_line(); @@ -242,20 +242,20 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } char VarElderberry = cs_subset_quad(sub, "Elderberry"); - TEST_MSG("%s = %d, %s\n", name, VarElderberry, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarElderberry, buf_string(err)); } // cs_str_native_set(cs, name, 4, NULL); // buf_reset(err); - // TEST_MSG("Expect error for next test\n"); + // TEST_MSG("Expect error for next test"); // rc = cs_str_string_get(cs, name, err); // if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) // { - // TEST_MSG("%s\n", buf_string(err)); + // TEST_MSG("%s", buf_string(err)); // return false; // } @@ -271,38 +271,38 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) const char *name = "Fig"; char value = MUTT_YES; - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); cs_str_native_set(cs, name, MUTT_NO, NULL); buf_reset(err); int rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } char VarFig = cs_subset_quad(sub, "Fig"); if (!TEST_CHECK(VarFig == value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set to '%d'\n", name, VarFig, value); + TEST_MSG("%s = %d, set to '%d'", name, VarFig, value); short_line(); buf_reset(err); - TEST_MSG("Setting %s to %d\n", name, value); + TEST_MSG("Setting %s to %d", name, value); rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK((rc & CSR_SUC_NO_CHANGE) != 0)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); } int invalid[] = { -1, 4 }; @@ -310,18 +310,18 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) { short_line(); cs_str_native_set(cs, name, MUTT_NO, NULL); - TEST_MSG("Setting %s to %d\n", name, invalid[i]); + TEST_MSG("Setting %s to %d", name, invalid[i]); buf_reset(err); rc = cs_str_native_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarFig = cs_subset_quad(sub, "Fig"); - TEST_MSG("%s = %d, set by '%d'\n", name, VarFig, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%d'", name, VarFig, invalid[i]); + TEST_MSG("This test should have failed"); return false; } } @@ -342,10 +342,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = %ld\n", name, value); + TEST_MSG("%s = %ld", name, value); log_line(__func__); return true; @@ -361,56 +361,56 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); char VarHawthorn = cs_subset_quad(sub, "Hawthorn"); - TEST_MSG("%s = %d\n", name, VarHawthorn); + TEST_MSG("%s = %d", name, VarHawthorn); int rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarHawthorn = cs_subset_quad(sub, "Hawthorn"); if (!TEST_CHECK(VarHawthorn != true)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarHawthorn); + TEST_MSG("Reset: %s = %d", name, VarHawthorn); short_line(); name = "Ilama"; buf_reset(err); char VarIlama = cs_subset_quad(sub, "Ilama"); - TEST_MSG("Initial: %s = %d\n", name, VarIlama); + TEST_MSG("Initial: %s = %d", name, VarIlama); dont_fail = true; rc = cs_str_string_set(cs, name, "ask-yes", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarIlama = cs_subset_quad(sub, "Ilama"); - TEST_MSG("Set: %s = %d\n", name, VarIlama); + TEST_MSG("Set: %s = %d", name, VarIlama); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarIlama = cs_subset_quad(sub, "Ilama"); if (!TEST_CHECK(VarIlama == MUTT_ASKYES)) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarIlama); + TEST_MSG("Reset: %s = %d", name, VarIlama); log_line(__func__); return true; @@ -427,15 +427,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "yes", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } char VarJackfruit = cs_subset_quad(sub, "Jackfruit"); - TEST_MSG("String: %s = %d\n", name, VarJackfruit); + TEST_MSG("String: %s = %d", name, VarJackfruit); short_line(); cs_str_native_set(cs, name, MUTT_NO, NULL); @@ -443,15 +443,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 1, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarJackfruit = cs_subset_quad(sub, "Jackfruit"); - TEST_MSG("Native: %s = %d\n", name, VarJackfruit); + TEST_MSG("Native: %s = %d", name, VarJackfruit); short_line(); name = "Kumquat"; @@ -460,15 +460,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "yes", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } char VarKumquat = cs_subset_quad(sub, "Kumquat"); - TEST_MSG("String: %s = %d\n", name, VarKumquat); + TEST_MSG("String: %s = %d", name, VarKumquat); short_line(); cs_str_native_set(cs, name, MUTT_NO, NULL); @@ -476,15 +476,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 1, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarKumquat = cs_subset_quad(sub, "Kumquat"); - TEST_MSG("Native: %s = %d\n", name, VarKumquat); + TEST_MSG("Native: %s = %d", name, VarKumquat); short_line(); name = "Lemon"; @@ -493,15 +493,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "yes", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } char VarLemon = cs_subset_quad(sub, "Lemon"); - TEST_MSG("String: %s = %d\n", name, VarLemon); + TEST_MSG("String: %s = %d", name, VarLemon); short_line(); cs_str_native_set(cs, name, MUTT_NO, NULL); @@ -509,15 +509,15 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, 1, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarLemon = cs_subset_quad(sub, "Lemon"); - TEST_MSG("Native: %s = %d\n", name, VarLemon); + TEST_MSG("Native: %s = %d", name, VarLemon); log_line(__func__); return true; @@ -528,8 +528,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %ld\n", parent, pval); - TEST_MSG("%15s = %ld\n", child, cval); + TEST_MSG("%15s = %ld", parent, pval); + TEST_MSG("%15s = %ld", child, cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -549,7 +549,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -558,7 +558,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "yes", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -569,12 +569,12 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "no", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", parent); + TEST_MSG("Value of %s wasn't changed", parent); } dump_native(cs, parent, child); short_line(); @@ -584,7 +584,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -595,7 +595,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -636,28 +636,28 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) rc = quad_he_toggle(NULL, he, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } rc = quad_he_toggle(NeoMutt->sub, NULL, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } rc = quad_str_toggle(NULL, "Apple", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } rc = quad_str_toggle(NeoMutt->sub, NULL, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_ERR_CODE)) { - TEST_MSG("Toggle succeeded when is shouldn't have\n"); + TEST_MSG("Toggle succeeded when is shouldn't have"); return false; } @@ -665,35 +665,35 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) { char before = tests[i].before; char after = tests[i].after; - TEST_MSG("test %zu\n", i); + TEST_MSG("test %zu", i); cs_str_native_set(cs, name, before, NULL); buf_reset(err); intptr_t value = cs_he_native_get(cs, he, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } char copy = value; if (!TEST_CHECK(copy == before)) { - TEST_MSG("Initial value is wrong: %s\n", buf_string(err)); + TEST_MSG("Initial value is wrong: %s", buf_string(err)); return false; } rc = quad_he_toggle(NeoMutt->sub, he, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Toggle failed: %s\n", buf_string(err)); + TEST_MSG("Toggle failed: %s", buf_string(err)); return false; } char VarNectarine = cs_subset_quad(sub, "Nectarine"); if (!TEST_CHECK(VarNectarine == after)) { - TEST_MSG("Toggle value is wrong: %s\n", buf_string(err)); + TEST_MSG("Toggle value is wrong: %s", buf_string(err)); return false; } } @@ -703,7 +703,7 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) rc = quad_he_toggle(&sub2, he, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } name = "Olive"; @@ -715,7 +715,7 @@ static bool test_toggle(struct ConfigSubset *sub, struct Buffer *err) rc = quad_he_toggle(NeoMutt->sub, he, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } log_line(__func__); diff --git a/test/config/regex.c b/test/config/regex.c index 06fc7db9a..eddbd2200 100644 --- a/test/config/regex.c +++ b/test/config/regex.c @@ -65,18 +65,18 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const struct Regex *VarApple = cs_subset_regex(sub, "Apple"); const struct Regex *VarBanana = cs_subset_regex(sub, "Banana"); - TEST_MSG("Apple = %s\n", VarApple->pattern); - TEST_MSG("Banana = %s\n", VarBanana->pattern); + TEST_MSG("Apple = %s", VarApple->pattern); + TEST_MSG("Banana = %s", VarBanana->pattern); if (!TEST_CHECK_STR_EQ(VarApple->pattern, "apple.*")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } if (!TEST_CHECK_STR_EQ(VarBanana->pattern, "banana.*")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } @@ -94,41 +94,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "apple.*")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_regex(sub, "Apple"); - TEST_MSG("Apple = '%s'\n", VarApple ? VarApple->pattern : ""); - TEST_MSG("Apple's initial value is %s\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple ? VarApple->pattern : ""); + TEST_MSG("Apple's initial value is %s", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "banana.*")) { - TEST_MSG("Banana's initial value is wrong: %s\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: %s", buf_string(value)); return false; } VarBanana = cs_subset_regex(sub, "Banana"); - TEST_MSG("Banana = '%s'\n", VarBanana ? VarBanana->pattern : ""); - TEST_MSG("Banana's initial value is %s\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana ? VarBanana->pattern : ""); + TEST_MSG("Banana's initial value is %s", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "up.*", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -136,7 +136,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "down.*", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -144,13 +144,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } const struct Regex *VarCherry = cs_subset_regex(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry->pattern); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry->pattern); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -174,13 +174,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } @@ -188,10 +188,10 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) regex = VarDamson ? VarDamson->pattern : NULL; if (!TEST_CHECK_STR_EQ(regex, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(regex), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(regex), NONULL(valid[i])); } name = "Elderberry"; @@ -201,13 +201,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } @@ -215,21 +215,21 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) regex = VarElderberry ? VarElderberry->pattern : NULL; if (!TEST_CHECK_STR_EQ(regex, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(regex), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(regex), NONULL(valid[i])); } buf_reset(err); rc = cs_str_string_set(cs, name, "[a-b", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -248,24 +248,24 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Regex *VarFig = cs_subset_regex(sub, "Fig"); regex = VarFig ? VarFig->pattern : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(regex), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(regex), buf_string(err)); name = "Guava"; buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Regex *VarGuava = cs_subset_regex(sub, "Guava"); regex = VarGuava ? VarGuava->pattern : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(regex), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(regex), buf_string(err)); name = "Hawthorn"; rc = cs_str_string_set(cs, name, "hawthorn", err); @@ -276,12 +276,12 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const struct Regex *VarHawthorn = cs_subset_regex(sub, "Hawthorn"); regex = VarHawthorn ? VarHawthorn->pattern : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(regex), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(regex), buf_string(err)); log_line(__func__); return true; @@ -295,7 +295,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) struct Regex *r = regex_new(NULL, 0, err); if (!TEST_CHECK(r == NULL)) { - TEST_MSG("regex_new() succeeded when is shouldn't have\n"); + TEST_MSG("regex_new() succeeded when is shouldn't have"); return false; } @@ -308,7 +308,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_native_set(cs, name, (intptr_t) r, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tns_out; } @@ -316,10 +316,10 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) regex = VarIlama ? VarIlama->pattern : NULL; if (!TEST_CHECK_STR_EQ(r->pattern, regex)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tns_out; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(regex), r->pattern); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(regex), r->pattern); regex_free(&r); r = regex_new("!world.*", DT_REGEX_ALLOW_NOT, err); @@ -329,29 +329,29 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) r, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tns_out; } VarIlama = cs_subset_regex(sub, "Ilama"); - TEST_MSG("'%s', not flag set to %d\n", VarIlama->pattern, VarIlama->pat_not); + TEST_MSG("'%s', not flag set to %d", VarIlama->pattern, VarIlama->pat_not); name = "Jackfruit"; buf_reset(err); rc = cs_str_native_set(cs, name, 0, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tns_out; } const struct Regex *VarJackfruit = cs_subset_regex(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit == NULL)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); goto tns_out; } regex = VarJackfruit ? VarJackfruit->pattern : NULL; - TEST_MSG("%s = '%s', set by NULL\n", name, NONULL(regex)); + TEST_MSG("%s = '%s', set by NULL", name, NONULL(regex)); regex_free(&r); r = regex_new("world.*", 0, err); @@ -365,11 +365,11 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) r, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tns_out; } @@ -397,12 +397,12 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) const struct Regex *VarLemon = cs_subset_regex(sub, "Lemon"); if (!TEST_CHECK(VarLemon == r)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } char *regex1 = VarLemon ? VarLemon->pattern : NULL; char *regex2 = r ? r->pattern : NULL; - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(regex1), NONULL(regex2)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(regex1), NONULL(regex2)); log_line(__func__); return true; @@ -419,18 +419,18 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) const struct Regex *VarMango = cs_subset_regex(sub, "Mango"); char *regex = VarMango ? VarMango->pattern : NULL; - TEST_MSG("Initial: %s = '%s'\n", name, NONULL(regex)); + TEST_MSG("Initial: %s = '%s'", name, NONULL(regex)); int rc = cs_str_string_set(cs, name, "hello.*", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarMango = cs_subset_regex(sub, "Mango"); regex = VarMango ? VarMango->pattern : NULL; - TEST_MSG("Set: %s = '%s'\n", name, NONULL(regex)); + TEST_MSG("Set: %s = '%s'", name, NONULL(regex)); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -438,20 +438,20 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) regex = VarMango ? VarMango->pattern : NULL; if (!TEST_CHECK_STR_EQ(regex, "mango.*")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, NONULL(regex)); + TEST_MSG("Reset: %s = '%s'", name, NONULL(regex)); rc = cs_str_reset(cs, "Nectarine", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -459,34 +459,34 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const struct Regex *VarOlive = cs_subset_regex(sub, "Olive"); - TEST_MSG("Initial: %s = '%s'\n", name, VarOlive->pattern); + TEST_MSG("Initial: %s = '%s'", name, VarOlive->pattern); dont_fail = true; rc = cs_str_string_set(cs, name, "hel*o", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarOlive = cs_subset_regex(sub, "Olive"); - TEST_MSG("Set: %s = '%s'\n", name, VarOlive->pattern); + TEST_MSG("Set: %s = '%s'", name, VarOlive->pattern); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarOlive = cs_subset_regex(sub, "Olive"); if (!TEST_CHECK_STR_EQ(VarOlive->pattern, "hel*o")) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, VarOlive->pattern); + TEST_MSG("Reset: %s = '%s'", name, VarOlive->pattern); log_line(__func__); return true; @@ -506,93 +506,93 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "hello.*", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Regex *VarPapaya = cs_subset_regex(sub, "Papaya"); regex = VarPapaya ? VarPapaya->pattern : NULL; - TEST_MSG("Regex: %s = %s\n", name, NONULL(regex)); + TEST_MSG("Regex: %s = %s", name, NONULL(regex)); buf_reset(err); rc = cs_str_native_set(cs, name, IP r, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarPapaya = cs_subset_regex(sub, "Papaya"); regex = VarPapaya ? VarPapaya->pattern : NULL; - TEST_MSG("Native: %s = %s\n", name, NONULL(regex)); + TEST_MSG("Native: %s = %s", name, NONULL(regex)); name = "Quince"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello.*", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Regex *VarQuince = cs_subset_regex(sub, "Quince"); regex = VarQuince ? VarQuince->pattern : NULL; - TEST_MSG("Regex: %s = %s\n", name, NONULL(regex)); + TEST_MSG("Regex: %s = %s", name, NONULL(regex)); buf_reset(err); rc = cs_str_native_set(cs, name, IP r, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarQuince = cs_subset_regex(sub, "Quince"); regex = VarQuince ? VarQuince->pattern : NULL; - TEST_MSG("Native: %s = %s\n", name, NONULL(regex)); + TEST_MSG("Native: %s = %s", name, NONULL(regex)); name = "Raspberry"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello.*", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Regex *VarRaspberry = cs_subset_regex(sub, "Raspberry"); regex = VarRaspberry ? VarRaspberry->pattern : NULL; - TEST_MSG("Regex: %s = %s\n", name, NONULL(regex)); + TEST_MSG("Regex: %s = %s", name, NONULL(regex)); buf_reset(err); rc = cs_str_native_set(cs, name, IP r, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarRaspberry = cs_subset_regex(sub, "Raspberry"); regex = VarRaspberry ? VarRaspberry->pattern : NULL; - TEST_MSG("Native: %s = %s\n", name, NONULL(regex)); + TEST_MSG("Native: %s = %s", name, NONULL(regex)); result = true; tv_out: @@ -612,8 +612,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch char *pstr = pa ? pa->pattern : NULL; char *cstr = ca ? ca->pattern : NULL; - TEST_MSG("%15s = %s\n", parent, NONULL(pstr)); - TEST_MSG("%15s = %s\n", child, NONULL(cstr)); + TEST_MSG("%15s = %s", parent, NONULL(pstr)); + TEST_MSG("%15s = %s", child, NONULL(cstr)); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -633,7 +633,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -642,7 +642,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "hello.*", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -652,7 +652,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "world.*", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -662,7 +662,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -672,7 +672,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/set.c b/test/config/set.c index da2c5b593..55b028bb0 100644 --- a/test/config/set.c +++ b/test/config/set.c @@ -258,7 +258,7 @@ bool creation_and_deletion_tests(struct ConfigSet *cs, struct Buffer *err) struct HashElem *cherry = cs_register_variable(cs, &cherryDef, err); if (!TEST_CHECK(cherry != NULL)) { - TEST_MSG("Variable registration failed: %s\n", buf_string(err)); + TEST_MSG("Variable registration failed: %s", buf_string(err)); return false; } @@ -266,7 +266,7 @@ bool creation_and_deletion_tests(struct ConfigSet *cs, struct Buffer *err) struct HashElem *damson = cs_register_variable(cs, &damsonDef, err); if (!TEST_CHECK(damson != NULL)) { - TEST_MSG("Variable registration failed: %s\n", buf_string(err)); + TEST_MSG("Variable registration failed: %s", buf_string(err)); return false; } } @@ -289,26 +289,26 @@ bool creation_and_deletion_tests(struct ConfigSet *cs, struct Buffer *err) buf_reset(err); if (!TEST_CHECK(cs_he_delete(cs, cherry, err) == CSR_SUCCESS)) { - TEST_MSG("HashElem deletion failed: %s\n", buf_string(err)); + TEST_MSG("HashElem deletion failed: %s", buf_string(err)); return false; } cherry = cs_get_elem(cs, "Cherry"); if (!TEST_CHECK(cherry == NULL)) { - TEST_MSG("Cherry not deleted.\n"); + TEST_MSG("Cherry not deleted."); return false; } buf_reset(err); if (!TEST_CHECK(cs_str_delete(cs, "Damson", err) == CSR_SUCCESS)) { - TEST_MSG("String deletion failed: %s\n", buf_string(err)); + TEST_MSG("String deletion failed: %s", buf_string(err)); return false; } struct HashElem *damson = cs_get_elem(cs, "Damson"); if (!TEST_CHECK(damson == NULL)) { - TEST_MSG("Damson not deleted.\n"); + TEST_MSG("Damson not deleted."); return false; } } @@ -316,7 +316,7 @@ bool creation_and_deletion_tests(struct ConfigSet *cs, struct Buffer *err) /* Delete unknown variable must fail */ if (!TEST_CHECK(cs_str_delete(cs, "does-not-exist", err) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Deletion of non-existent variable succeeded but should have failed: %s\n", + TEST_MSG("Deletion of non-existent variable succeeded but should have failed: %s", buf_string(err)); return false; } @@ -327,13 +327,13 @@ bool creation_and_deletion_tests(struct ConfigSet *cs, struct Buffer *err) buf_reset(err); if (!TEST_CHECK(cs_he_delete(cs, banana, NULL) == CSR_SUCCESS)) { - TEST_MSG("HashElem deletion failed: %s\n", buf_string(err)); + TEST_MSG("HashElem deletion failed: %s", buf_string(err)); return false; } struct HashElem *banana_after = cs_get_elem(cs, "Banana"); if (!TEST_CHECK(banana_after == NULL)) { - TEST_MSG("Banana not deleted.\n"); + TEST_MSG("Banana not deleted."); return false; } } @@ -357,11 +357,11 @@ void test_config_set(void) if (TEST_CHECK(!cs_register_type(cs, &CstDummy))) { - TEST_MSG("Expected error\n"); + TEST_MSG("Expected error"); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -380,11 +380,11 @@ void test_config_set(void) if (TEST_CHECK(!cs_register_type(cs, &CstDummy2))) { - TEST_MSG("Expected error\n"); + TEST_MSG("Expected error"); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -393,11 +393,11 @@ void test_config_set(void) if (TEST_CHECK(!cs_register_variables(cs, Vars, DT_NO_FLAGS))) { - TEST_MSG("Expected error\n"); + TEST_MSG("Expected error"); } else { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -411,66 +411,66 @@ void test_config_set(void) int result = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(result) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Expected error: Unknown var '%s'\n", name); + TEST_MSG("Expected error: Unknown var '%s'", name); } else { - TEST_MSG("This should have failed 1\n"); + TEST_MSG("This should have failed 1"); return; } result = cs_str_string_plus_equals(cs, name, "42", err); if (TEST_CHECK(CSR_RESULT(result) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Expected error: Unknown var '%s'\n", name); + TEST_MSG("Expected error: Unknown var '%s'", name); } else { - TEST_MSG("This should have failed 1\n"); + TEST_MSG("This should have failed 1"); return; } result = cs_str_string_minus_equals(cs, name, "42", err); if (TEST_CHECK(CSR_RESULT(result) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Expected error: Unknown var '%s'\n", name); + TEST_MSG("Expected error: Unknown var '%s'", name); } else { - TEST_MSG("This should have failed 1\n"); + TEST_MSG("This should have failed 1"); return; } result = cs_str_string_get(cs, name, err); if (TEST_CHECK(CSR_RESULT(result) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Expected error: Unknown var '%s'\n", name); + TEST_MSG("Expected error: Unknown var '%s'", name); } else { - TEST_MSG("This should have failed 2\n"); + TEST_MSG("This should have failed 2"); return; } result = cs_str_native_set(cs, name, IP "hello", err); if (TEST_CHECK(CSR_RESULT(result) == CSR_ERR_UNKNOWN)) { - TEST_MSG("Expected error: Unknown var '%s'\n", name); + TEST_MSG("Expected error: Unknown var '%s'", name); } else { - TEST_MSG("This should have failed 3\n"); + TEST_MSG("This should have failed 3"); return; } intptr_t native = cs_str_native_get(cs, name, err); if (TEST_CHECK(native == INT_MIN)) { - TEST_MSG("Expected error: Unknown var '%s'\n", name); + TEST_MSG("Expected error: Unknown var '%s'", name); } else { - TEST_MSG("This should have failed 4\n"); + TEST_MSG("This should have failed 4"); return; } diff --git a/test/config/slist.c b/test/config/slist.c index 75efcba81..97de7592d 100644 --- a/test/config/slist.c +++ b/test/config/slist.c @@ -132,7 +132,7 @@ static void slist_dump(const struct Slist *list, struct Buffer *buf) if (STAILQ_NEXT(np, entries)) buf_addstr(buf, ","); } - TEST_MSG("%s\n", buf_string(buf)); + TEST_MSG("%s", buf_string(buf)); buf_reset(buf); } @@ -157,13 +157,13 @@ static bool test_slist_parse(struct Buffer *err) uint32_t flags = SLIST_SEP_COLON | SLIST_ALLOW_EMPTY; slist_flags(flags, err); TEST_MSG("Flags: %s", buf_string(err)); - TEST_MSG("\n"); + TEST_MSG(""); buf_reset(err); struct Slist *list = NULL; for (size_t i = 0; i < mutt_array_size(init); i++) { - TEST_MSG(">>%s<<\n", init[i] ? init[i] : "NULL"); + TEST_MSG(">>%s<<", init[i] ? init[i] : "NULL"); list = slist_parse(init[i], flags); slist_dump(list, err); slist_free(&list); @@ -259,7 +259,7 @@ static bool test_slist_is_member(struct Buffer *err) for (size_t i = 0; i < mutt_array_size(values); i++) { - TEST_MSG("member '%s' : %s\n", values[i], + TEST_MSG("member '%s' : %s", values[i], slist_is_member(list, values[i]) ? "yes" : "no"); } @@ -355,11 +355,11 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const struct Slist *VarApple = cs_subset_slist(sub, "Apple"); slist_flags(VarApple->flags, err); - TEST_MSG("Apple, %ld items, %s flags\n", VarApple->count, buf_string(err)); + TEST_MSG("Apple, %ld items, %s flags", VarApple->count, buf_string(err)); buf_reset(err); if (VarApple->count != 1) { - TEST_MSG("Apple should have 1 item\n"); + TEST_MSG("Apple should have 1 item"); return false; } @@ -374,11 +374,11 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const struct Slist *VarBanana = cs_subset_slist(sub, "Banana"); slist_flags(VarBanana->flags, err); - TEST_MSG("Banana, %ld items, %s flags\n", VarBanana->count, buf_string(err)); + TEST_MSG("Banana, %ld items, %s flags", VarBanana->count, buf_string(err)); buf_reset(err); if (VarBanana->count != 2) { - TEST_MSG("Banana should have 2 items\n"); + TEST_MSG("Banana should have 2 items"); return false; } @@ -393,11 +393,11 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const struct Slist *VarCherry = cs_subset_slist(sub, "Cherry"); slist_flags(VarCherry->flags, err); - TEST_MSG("Cherry, %ld items, %s flags\n", VarCherry->count, buf_string(err)); + TEST_MSG("Cherry, %ld items, %s flags", VarCherry->count, buf_string(err)); buf_reset(err); if (VarCherry->count != 3) { - TEST_MSG("Cherry should have 3 items\n"); + TEST_MSG("Cherry should have 3 items"); return false; } @@ -415,7 +415,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_initial_set(cs, name, value, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -423,7 +423,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, name, value, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -432,7 +432,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, name, err); if (!TEST_CHECK(rc == (CSR_SUCCESS | CSR_SUC_EMPTY))) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -451,7 +451,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "pig:quail:rhino", err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -460,7 +460,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "", err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -469,7 +469,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, NULL, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -478,7 +478,7 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "pig:quail:rhino", err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -499,23 +499,23 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_initial_get(cs, name, initial); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (!mutt_str_equal(buf_string(initial), buf_string(err))) { - TEST_MSG("Differ: %s '%s' '%s'\n", name, buf_string(initial), buf_string(err)); + TEST_MSG("Differ: %s '%s' '%s'", name, buf_string(initial), buf_string(err)); return false; } - TEST_MSG("Match: %s '%s' '%s'\n", name, buf_string(initial), buf_string(err)); + TEST_MSG("Match: %s '%s' '%s'", name, buf_string(initial), buf_string(err)); buf_reset(err); buf_reset(initial); @@ -524,23 +524,23 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, name, initial); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (!mutt_str_equal(buf_string(initial), buf_string(err))) { - TEST_MSG("Differ: %s '%s' '%s'\n", name, buf_string(initial), buf_string(err)); + TEST_MSG("Differ: %s '%s' '%s'", name, buf_string(initial), buf_string(err)); return false; } - TEST_MSG("Match: %s '%s' '%s'\n", name, buf_string(initial), buf_string(err)); + TEST_MSG("Match: %s '%s' '%s'", name, buf_string(initial), buf_string(err)); buf_reset(err); buf_reset(initial); @@ -549,23 +549,23 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, name, initial); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (!mutt_str_equal(buf_string(initial), buf_string(err))) { - TEST_MSG("Differ: %s '%s' '%s'\n", name, buf_string(initial), buf_string(err)); + TEST_MSG("Differ: %s '%s' '%s'", name, buf_string(initial), buf_string(err)); return false; } - TEST_MSG("Match: %s '%s' '%s'\n", name, buf_string(initial), buf_string(err)); + TEST_MSG("Match: %s '%s' '%s'", name, buf_string(initial), buf_string(err)); buf_pool_release(&initial); return true; @@ -584,7 +584,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_native_set(cs, name, (intptr_t) list, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -592,7 +592,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -603,7 +603,7 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) NULL, err); if (!TEST_CHECK(rc == (CSR_SUCCESS | CSR_SUC_EMPTY))) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -625,7 +625,7 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) const struct Slist *VarJackfruit = cs_subset_slist(sub, "Jackfruit"); if (!TEST_CHECK(VarJackfruit == sl)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } @@ -664,21 +664,21 @@ static bool test_plus_equals(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, PlusTests[i][0], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Set failed: %s\n", buf_string(err)); + TEST_MSG("Set failed: %s", buf_string(err)); return false; } rc = cs_str_string_plus_equals(cs, name, PlusTests[i][1], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("PlusEquals failed: %s\n", buf_string(err)); + TEST_MSG("PlusEquals failed: %s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } @@ -692,11 +692,11 @@ static bool test_plus_equals(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_plus_equals(cs, name, "nine", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -739,21 +739,21 @@ static bool test_minus_equals(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, MinusTests[i][0], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Set failed: %s\n", buf_string(err)); + TEST_MSG("Set failed: %s", buf_string(err)); return false; } rc = cs_str_string_minus_equals(cs, name, MinusTests[i][1], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("MinusEquals failed: %s\n", buf_string(err)); + TEST_MSG("MinusEquals failed: %s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } @@ -767,11 +767,11 @@ static bool test_minus_equals(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_minus_equals(cs, name, "two", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -789,18 +789,18 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) const struct Slist *VarLemon = cs_subset_slist(sub, "Lemon"); char *item = STAILQ_FIRST(&VarLemon->head)->data; - TEST_MSG("Initial: %s = '%s'\n", name, item); + TEST_MSG("Initial: %s = '%s'", name, item); int rc = cs_str_string_set(cs, name, "apple", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarLemon = cs_subset_slist(sub, "Lemon"); item = STAILQ_FIRST(&VarLemon->head)->data; - TEST_MSG("Set: %s = '%s'\n", name, item); + TEST_MSG("Set: %s = '%s'", name, item); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -808,35 +808,35 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) item = STAILQ_FIRST(&VarLemon->head)->data; if (!TEST_CHECK_STR_EQ(item, "lemon")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, item); + TEST_MSG("Reset: %s = '%s'", name, item); name = "Mango"; buf_reset(err); const struct Slist *VarMango = cs_subset_slist(sub, "Mango"); item = STAILQ_FIRST(&VarMango->head)->data; - TEST_MSG("Initial: %s = '%s'\n", name, item); + TEST_MSG("Initial: %s = '%s'", name, item); dont_fail = true; rc = cs_str_string_set(cs, name, "banana", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarMango = cs_subset_slist(sub, "Mango"); item = STAILQ_FIRST(&VarMango->head)->data; - TEST_MSG("Set: %s = '%s'\n", name, item); + TEST_MSG("Set: %s = '%s'", name, item); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -844,12 +844,12 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) item = STAILQ_FIRST(&VarMango->head)->data; if (!TEST_CHECK_STR_EQ(item, "banana")) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } item = STAILQ_FIRST(&VarMango->head)->data; - TEST_MSG("Reset: %s = '%s'\n", name, item); + TEST_MSG("Reset: %s = '%s'", name, item); log_line(__func__); return true; @@ -869,93 +869,93 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "banana", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Slist *VarNectarine = cs_subset_slist(sub, "Nectarine"); item = STAILQ_FIRST(&VarNectarine->head)->data; - TEST_MSG("Address: %s = %s\n", name, item); + TEST_MSG("Address: %s = %s", name, item); buf_reset(err); rc = cs_str_native_set(cs, name, IP list, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarNectarine = cs_subset_slist(sub, "Nectarine"); item = STAILQ_FIRST(&VarNectarine->head)->data; - TEST_MSG("Native: %s = %s\n", name, item); + TEST_MSG("Native: %s = %s", name, item); name = "Olive"; buf_reset(err); rc = cs_str_string_set(cs, name, "cherry", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Slist *VarOlive = cs_subset_slist(sub, "Olive"); item = STAILQ_FIRST(&VarOlive->head)->data; - TEST_MSG("Address: %s = %s\n", name, item); + TEST_MSG("Address: %s = %s", name, item); buf_reset(err); rc = cs_str_native_set(cs, name, IP list, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarOlive = cs_subset_slist(sub, "Olive"); item = STAILQ_FIRST(&VarOlive->head)->data; - TEST_MSG("Native: %s = %s\n", name, item); + TEST_MSG("Native: %s = %s", name, item); name = "Papaya"; buf_reset(err); rc = cs_str_string_set(cs, name, "damson", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Slist *VarPapaya = cs_subset_slist(sub, "Papaya"); item = STAILQ_FIRST(&VarPapaya->head)->data; - TEST_MSG("Address: %s = %s\n", name, item); + TEST_MSG("Address: %s = %s", name, item); buf_reset(err); rc = cs_str_native_set(cs, name, IP list, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarPapaya = cs_subset_slist(sub, "Papaya"); item = STAILQ_FIRST(&VarPapaya->head)->data; - TEST_MSG("Native: %s = %s\n", name, item); + TEST_MSG("Native: %s = %s", name, item); result = true; tv_out: @@ -978,11 +978,11 @@ static bool test_charset_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } @@ -990,42 +990,42 @@ static bool test_charset_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "utf-8", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } const struct Slist *VarWolfberry = cs_subset_slist(sub, "Wolfberry"); item = STAILQ_FIRST(&VarWolfberry->head)->data; - TEST_MSG("Address: %s = %s\n", name, item); + TEST_MSG("Address: %s = %s", name, item); buf_reset(err); rc = cs_str_native_set(cs, name, IP list, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } VarWolfberry = cs_subset_slist(sub, "Wolfberry"); item = STAILQ_FIRST(&VarWolfberry->head)->data; - TEST_MSG("Native: %s = %s\n", name, item); + TEST_MSG("Native: %s = %s", name, item); // When one of the charsets is invalid, it fails buf_reset(err); rc = cs_str_string_set(cs, name, "us-ascii:utf-3", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); goto tv_out; } @@ -1047,8 +1047,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch char *pstr = pl ? STAILQ_FIRST(&pl->head)->data : NULL; char *cstr = cl ? STAILQ_FIRST(&cl->head)->data : NULL; - TEST_MSG("%15s = %s\n", parent, NONULL(pstr)); - TEST_MSG("%15s = %s\n", child, NONULL(cstr)); + TEST_MSG("%15s = %s", parent, NONULL(pstr)); + TEST_MSG("%15s = %s", child, NONULL(cstr)); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -1068,7 +1068,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -1077,7 +1077,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "apple", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -1087,7 +1087,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "banana", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -1097,7 +1097,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -1107,7 +1107,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/sort.c b/test/config/sort.c index 0163c1517..ea8550813 100644 --- a/test/config/sort.c +++ b/test/config/sort.c @@ -93,19 +93,19 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) short VarApple = cs_subset_sort(sub, "Apple"); short VarBanana = cs_subset_sort(sub, "Banana"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Banana = %d\n", VarBanana); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Banana = %d", VarBanana); if (!TEST_CHECK(VarApple == 1)) { - TEST_MSG("Expected: %d\n", 1); - TEST_MSG("Actual : %d\n", VarApple); + TEST_MSG("Expected: %d", 1); + TEST_MSG("Actual : %d", VarApple); } if (!TEST_CHECK(VarBanana == 2)) { - TEST_MSG("Expected: %d\n", 2); - TEST_MSG("Actual : %d\n", VarBanana); + TEST_MSG("Expected: %d", 2); + TEST_MSG("Actual : %d", VarBanana); } cs_str_string_set(cs, "Apple", "threads", err); @@ -122,41 +122,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "date")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } VarApple = cs_subset_sort(sub, "Apple"); - TEST_MSG("Apple = %d\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = %d", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } if (!TEST_CHECK_STR_EQ(buf_string(value), "size")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } VarBanana = cs_subset_sort(sub, "Banana"); - TEST_MSG("Banana = %d\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = %d", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "size", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -164,13 +164,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } short VarCherry = cs_subset_sort(sub, "Cherry"); - TEST_MSG("Cherry = %s\n", mutt_map_get_name(VarCherry, SortTestMethods)); - TEST_MSG("Cherry's initial value is %s\n", buf_string(value)); + TEST_MSG("Cherry = %s", mutt_map_get_name(VarCherry, SortTestMethods)); + TEST_MSG("Cherry's initial value is %s", buf_string(value)); buf_pool_release(&value); log_line(__func__); @@ -194,23 +194,23 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name_list[i], map[j].name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", map[j].name); + TEST_MSG("Value of %s wasn't changed", map[j].name); continue; } short VarTest = cs_subset_sort(sub, name_list[i]); if (!TEST_CHECK(VarTest == map[j].value)) { - TEST_MSG("Value of %s wasn't changed\n", map[j].name); + TEST_MSG("Value of %s wasn't changed", map[j].name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name_list[i], VarTest, map[j].name); + TEST_MSG("%s = %d, set by '%s'", name_list[i], VarTest, map[j].name); } const char *invalid[] = { @@ -226,13 +226,13 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name_list[i], invalid[j], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { short VarTest = cs_subset_sort(sub, map[j].name); - TEST_MSG("%s = %d, set by '%s'\n", name_list[i], VarTest, invalid[j]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name_list[i], VarTest, invalid[j]); + TEST_MSG("This test should have failed"); return false; } } @@ -243,14 +243,14 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "last-date-sent", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarDamson = cs_subset_sort(sub, "Damson"); if (!TEST_CHECK(VarDamson == (SORT_DATE | SORT_LAST))) { - TEST_MSG("Expected %d, got %d\n", (SORT_DATE | SORT_LAST), VarDamson); + TEST_MSG("Expected %d, got %d", (SORT_DATE | SORT_LAST), VarDamson); return false; } @@ -258,14 +258,14 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "reverse-score", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarDamson = cs_subset_sort(sub, "Damson"); if (!TEST_CHECK(VarDamson == (SORT_SCORE | SORT_REVERSE))) { - TEST_MSG("Expected %d, got %d\n", (SORT_DATE | SORT_LAST), VarDamson); + TEST_MSG("Expected %d, got %d", (SORT_DATE | SORT_LAST), VarDamson); return false; } @@ -284,40 +284,40 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } short VarJackfruit = cs_subset_sort(sub, "Jackfruit"); - TEST_MSG("%s = %d, %s\n", name, VarJackfruit, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarJackfruit, buf_string(err)); cs_str_native_set(cs, name, SORT_THREADS, NULL); buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } VarJackfruit = cs_subset_sort(sub, "Jackfruit"); - TEST_MSG("%s = %d, %s\n", name, VarJackfruit, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarJackfruit, buf_string(err)); // cs_str_native_set(cs, name, -1, NULL); // buf_reset(err); - // TEST_MSG("Expect error for next test\n"); + // TEST_MSG("Expect error for next test"); // rc = cs_str_string_get(cs, name, err); // if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) // { - // TEST_MSG("%s\n", buf_string(err)); + // TEST_MSG("%s", buf_string(err)); // return false; // } buf_reset(err); name = "Raspberry"; - TEST_MSG("Expect error for next test\n"); + TEST_MSG("Expect error for next test"); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -328,11 +328,11 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } short VarDamson = cs_subset_sort(sub, "Damson"); - TEST_MSG("%s = %d, %s\n", name, VarDamson, buf_string(err)); + TEST_MSG("%s = %d, %s", name, VarDamson, buf_string(err)); log_line(__func__); return true; @@ -355,23 +355,23 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name_list[i], map[j].value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", map[j].name); + TEST_MSG("Value of %s wasn't changed", map[j].name); continue; } short VarTest = cs_subset_sort(sub, name_list[i]); if (!TEST_CHECK(VarTest == map[j].value)) { - TEST_MSG("Value of %s wasn't changed\n", map[j].name); + TEST_MSG("Value of %s wasn't changed", map[j].name); return false; } - TEST_MSG("%s = %d, set by '%s'\n", name_list[i], VarTest, map[j].name); + TEST_MSG("%s = %d, set by '%s'", name_list[i], VarTest, map[j].name); } } @@ -382,18 +382,18 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarKumquat = cs_subset_sort(sub, "Kumquat"); if (!TEST_CHECK(VarKumquat == value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %d, set to '%d'\n", name, VarKumquat, value); + TEST_MSG("%s = %d, set to '%d'", name, VarKumquat, value); int invalid[] = { -1, 999 }; for (unsigned int i = 0; i < mutt_array_size(invalid); i++) @@ -403,13 +403,13 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, invalid[i], err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { VarKumquat = cs_subset_sort(sub, "Kumquat"); - TEST_MSG("%s = %d, set by '%d'\n", name, VarKumquat, invalid[i]); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%d'", name, VarKumquat, invalid[i]); + TEST_MSG("This test should have failed"); return false; } } @@ -419,14 +419,14 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (SORT_DATE | SORT_LAST), err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarDamson = cs_subset_sort(sub, "Damson"); if (!TEST_CHECK(VarDamson == (SORT_DATE | SORT_LAST))) { - TEST_MSG("Expected %d, got %d\n", (SORT_DATE | SORT_LAST), VarDamson); + TEST_MSG("Expected %d, got %d", (SORT_DATE | SORT_LAST), VarDamson); return false; } @@ -434,14 +434,14 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (SORT_SCORE | SORT_REVERSE), err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarDamson = cs_subset_sort(sub, "Damson"); if (!TEST_CHECK(VarDamson == (SORT_SCORE | SORT_REVERSE))) { - TEST_MSG("Expected %d, got %d\n", (SORT_DATE | SORT_LAST), VarDamson); + TEST_MSG("Expected %d, got %d", (SORT_DATE | SORT_LAST), VarDamson); return false; } @@ -460,10 +460,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK(value == SORT_THREADS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = %ld\n", name, value); + TEST_MSG("%s = %ld", name, value); log_line(__func__); return true; @@ -481,23 +481,23 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarMango = cs_subset_sort(sub, "Mango"); if (VarMango == SORT_SUBJECT) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarMango); + TEST_MSG("Reset: %s = %d", name, VarMango); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -505,34 +505,34 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); short VarNectarine = cs_subset_sort(sub, "Nectarine"); - TEST_MSG("Initial: %s = %d\n", name, VarNectarine); + TEST_MSG("Initial: %s = %d", name, VarNectarine); dont_fail = true; rc = cs_str_string_set(cs, name, "size", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarNectarine = cs_subset_sort(sub, "Nectarine"); - TEST_MSG("Set: %s = %d\n", name, VarNectarine); + TEST_MSG("Set: %s = %d", name, VarNectarine); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_sort(sub, "Nectarine"); if (!TEST_CHECK(VarNectarine == SORT_SIZE)) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = %d\n", name, VarNectarine); + TEST_MSG("Reset: %s = %d", name, VarNectarine); log_line(__func__); return true; @@ -549,30 +549,30 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "threads", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarOlive = cs_subset_sort(sub, "Olive"); - TEST_MSG("String: %s = %d\n", name, VarOlive); + TEST_MSG("String: %s = %d", name, VarOlive); cs_str_native_set(cs, name, SORT_SUBJECT, NULL); buf_reset(err); rc = cs_str_native_set(cs, name, SORT_THREADS, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarOlive = cs_subset_sort(sub, "Olive"); - TEST_MSG("Native: %s = %d\n", name, VarOlive); + TEST_MSG("Native: %s = %d", name, VarOlive); name = "Papaya"; cs_str_native_set(cs, name, SORT_SUBJECT, NULL); @@ -580,30 +580,30 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "threads", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarPapaya = cs_subset_sort(sub, "Papaya"); - TEST_MSG("String: %s = %d\n", name, VarPapaya); + TEST_MSG("String: %s = %d", name, VarPapaya); cs_str_native_set(cs, name, SORT_SUBJECT, NULL); buf_reset(err); rc = cs_str_native_set(cs, name, SORT_THREADS, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarPapaya = cs_subset_sort(sub, "Papaya"); - TEST_MSG("Native: %s = %d\n", name, VarPapaya); + TEST_MSG("Native: %s = %d", name, VarPapaya); name = "Quince"; cs_str_native_set(cs, name, SORT_SUBJECT, NULL); @@ -611,30 +611,30 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "threads", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } short VarQuince = cs_subset_sort(sub, "Quince"); - TEST_MSG("String: %s = %d\n", name, VarQuince); + TEST_MSG("String: %s = %d", name, VarQuince); cs_str_native_set(cs, name, SORT_SUBJECT, NULL); buf_reset(err); rc = cs_str_native_set(cs, name, SORT_THREADS, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarQuince = cs_subset_sort(sub, "Quince"); - TEST_MSG("Native: %s = %d\n", name, VarQuince); + TEST_MSG("Native: %s = %d", name, VarQuince); log_line(__func__); return true; @@ -645,8 +645,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %ld\n", parent, pval); - TEST_MSG("%15s = %ld\n", child, cval); + TEST_MSG("%15s = %ld", parent, pval); + TEST_MSG("%15s = %ld", child, cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -666,7 +666,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -676,7 +676,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "threads", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -686,7 +686,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "score", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -696,7 +696,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -706,7 +706,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -728,24 +728,24 @@ static bool test_sort_type(struct ConfigSubset *sub, struct Buffer *err) const char *value = "alpha"; buf_reset(err); - TEST_MSG("Expect error for next test\n"); + TEST_MSG("Expect error for next test"); int rc = cs_str_string_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { short VarRaspberry = cs_subset_sort(sub, "Raspberry"); - TEST_MSG("%s = %d, set by '%s'\n", name, VarRaspberry, value); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by '%s'", name, VarRaspberry, value); + TEST_MSG("This test should have failed"); return false; } buf_reset(err); - TEST_MSG("Expect error for next test\n"); + TEST_MSG("Expect error for next test"); rc = cs_str_native_set(cs, name, SORT_THREADS, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { short VarRaspberry = cs_subset_sort(sub, "Raspberry"); - TEST_MSG("%s = %d, set by %d\n", name, VarRaspberry, SORT_THREADS); - TEST_MSG("This test should have failed\n"); + TEST_MSG("%s = %d, set by %d", name, VarRaspberry, SORT_THREADS); + TEST_MSG("This test should have failed"); return false; } diff --git a/test/config/string.c b/test/config/string.c index d02c6cace..8a5edb3fd 100644 --- a/test/config/string.c +++ b/test/config/string.c @@ -68,18 +68,18 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) const char *VarApple = cs_subset_string(sub, "Apple"); const char *VarBanana = cs_subset_string(sub, "Banana"); - TEST_MSG("Apple = %s\n", VarApple); - TEST_MSG("Banana = %s\n", VarBanana); + TEST_MSG("Apple = %s", VarApple); + TEST_MSG("Banana = %s", VarBanana); if (!TEST_CHECK_STR_EQ(VarApple, "apple")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } if (!TEST_CHECK_STR_EQ(VarBanana, "banana")) { - TEST_MSG("Error: initial values were wrong\n"); + TEST_MSG("Error: initial values were wrong"); return false; } @@ -97,41 +97,41 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Apple", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } VarApple = cs_subset_string(sub, "Apple"); if (!TEST_CHECK_STR_EQ(buf_string(value), "apple")) { - TEST_MSG("Apple's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Apple's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Apple = '%s'\n", VarApple); - TEST_MSG("Apple's initial value is '%s'\n", buf_string(value)); + TEST_MSG("Apple = '%s'", VarApple); + TEST_MSG("Apple's initial value is '%s'", buf_string(value)); buf_reset(value); rc = cs_str_initial_get(cs, "Banana", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } VarBanana = cs_subset_string(sub, "Banana"); if (!TEST_CHECK_STR_EQ(buf_string(value), "banana")) { - TEST_MSG("Banana's initial value is wrong: '%s'\n", buf_string(value)); + TEST_MSG("Banana's initial value is wrong: '%s'", buf_string(value)); return false; } - TEST_MSG("Banana = '%s'\n", VarBanana); - TEST_MSG("Banana's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Banana = '%s'", VarBanana); + TEST_MSG("Banana's initial value is '%s'", NONULL(buf_string(value))); buf_reset(value); rc = cs_str_initial_set(cs, "Cherry", "train", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -139,7 +139,7 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_set(cs, "Cherry", "plane", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } @@ -147,13 +147,13 @@ static bool test_initial_values(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_initial_get(cs, "Cherry", value); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(value)); + TEST_MSG("%s", buf_string(value)); return false; } const char *VarCherry = cs_subset_string(sub, "Cherry"); - TEST_MSG("Cherry = '%s'\n", VarCherry); - TEST_MSG("Cherry's initial value is '%s'\n", NONULL(buf_string(value))); + TEST_MSG("Cherry = '%s'", VarCherry); + TEST_MSG("Cherry's initial value is '%s'", NONULL(buf_string(value))); buf_pool_release(&value); log_line(__func__); @@ -175,23 +175,23 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarDamson = cs_subset_string(sub, "Damson"); if (!TEST_CHECK_STR_EQ(VarDamson, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarDamson), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarDamson), NONULL(valid[i])); short_line(); } @@ -200,11 +200,11 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -216,23 +216,23 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarElderberry = cs_subset_string(sub, "Elderberry"); if (!TEST_CHECK_STR_EQ(VarElderberry, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarElderberry), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarElderberry), NONULL(valid[i])); } log_line(__func__); @@ -249,22 +249,22 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarGuava = cs_subset_string(sub, "Guava"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarGuava), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarGuava), buf_string(err)); name = "Hawthorn"; buf_reset(err); rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarHawthorn = cs_subset_string(sub, "Hawthorn"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarHawthorn), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarHawthorn), buf_string(err)); name = "Ilama"; rc = cs_str_string_set(cs, name, "ilama", err); @@ -275,11 +275,11 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarIlama = cs_subset_string(sub, "Ilama"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarIlama), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarIlama), buf_string(err)); log_line(__func__); return true; @@ -300,23 +300,23 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarJackfruit = cs_subset_string(sub, "Jackfruit"); if (!TEST_CHECK_STR_EQ(VarJackfruit, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarJackfruit), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarJackfruit), NONULL(valid[i])); short_line(); } @@ -325,11 +325,11 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) "", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -341,23 +341,23 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_native_set(cs, name, (intptr_t) valid[i], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } if (rc & CSR_SUC_NO_CHANGE) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); continue; } const char *VarKumquat = cs_subset_string(sub, "Kumquat"); if (!TEST_CHECK_STR_EQ(VarKumquat, valid[i])) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(VarKumquat), NONULL(valid[i])); + TEST_MSG("%s = '%s', set by '%s'", name, NONULL(VarKumquat), NONULL(valid[i])); } log_line(__func__); @@ -379,10 +379,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) intptr_t value = cs_str_native_get(cs, name, err); if (!TEST_CHECK_STR_EQ((char *) value, VarMango)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = '%s', '%s'\n", name, VarMango, (char *) value); + TEST_MSG("%s = '%s', '%s'", name, VarMango, (char *) value); log_line(__func__); return true; @@ -416,21 +416,21 @@ static bool test_string_plus_equals(struct ConfigSubset *sub, struct Buffer *err rc = cs_str_string_set(cs, name, PlusTests[i][0], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Set failed: %s\n", buf_string(err)); + TEST_MSG("Set failed: %s", buf_string(err)); return false; } rc = cs_str_string_plus_equals(cs, name, PlusTests[i][1], err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("PlusEquals failed: %s\n", buf_string(err)); + TEST_MSG("PlusEquals failed: %s", buf_string(err)); return false; } rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } @@ -451,33 +451,33 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const char *VarNectarine = cs_subset_string(sub, "Nectarine"); - TEST_MSG("Initial: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Initial: %s = '%s'", name, VarNectarine); int rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarNectarine = cs_subset_string(sub, "Nectarine"); - TEST_MSG("Set: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Set: %s = '%s'", name, VarNectarine); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarNectarine = cs_subset_string(sub, "Nectarine"); if (!TEST_CHECK_STR_EQ(VarNectarine, "nectarine")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, VarNectarine); + TEST_MSG("Reset: %s = '%s'", name, VarNectarine); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -485,34 +485,34 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const char *VarOlive = cs_subset_string(sub, "Olive"); - TEST_MSG("Initial: %s = '%s'\n", name, VarOlive); + TEST_MSG("Initial: %s = '%s'", name, VarOlive); dont_fail = true; rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; VarOlive = cs_subset_string(sub, "Olive"); - TEST_MSG("Set: %s = '%s'\n", name, VarOlive); + TEST_MSG("Set: %s = '%s'", name, VarOlive); dont_fail = false; rc = cs_str_reset(cs, name, err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarOlive = cs_subset_string(sub, "Olive"); if (!TEST_CHECK_STR_EQ(VarOlive, "hello")) { - TEST_MSG("Value of %s changed\n", name); + TEST_MSG("Value of %s changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, VarOlive); + TEST_MSG("Reset: %s = '%s'", name, VarOlive); log_line(__func__); return true; @@ -528,113 +528,113 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarPapaya = cs_subset_string(sub, "Papaya"); - TEST_MSG("String: %s = %s\n", name, VarPapaya); + TEST_MSG("String: %s = %s", name, VarPapaya); buf_reset(err); rc = cs_str_native_set(cs, name, IP "world", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarPapaya = cs_subset_string(sub, "Papaya"); - TEST_MSG("Native: %s = %s\n", name, VarPapaya); + TEST_MSG("Native: %s = %s", name, VarPapaya); name = "Quince"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarQuince = cs_subset_string(sub, "Quince"); - TEST_MSG("String: %s = %s\n", name, VarQuince); + TEST_MSG("String: %s = %s", name, VarQuince); buf_reset(err); rc = cs_str_native_set(cs, name, IP "world", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarQuince = cs_subset_string(sub, "Quince"); - TEST_MSG("Native: %s = %s\n", name, VarQuince); + TEST_MSG("Native: %s = %s", name, VarQuince); name = "Raspberry"; buf_reset(err); rc = cs_str_string_set(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarRaspberry = cs_subset_string(sub, "Raspberry"); - TEST_MSG("String: %s = %s\n", name, VarRaspberry); + TEST_MSG("String: %s = %s", name, VarRaspberry); buf_reset(err); rc = cs_str_native_set(cs, name, IP "world", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarRaspberry = cs_subset_string(sub, "Raspberry"); - TEST_MSG("Native: %s = %s\n", name, VarRaspberry); + TEST_MSG("Native: %s = %s", name, VarRaspberry); name = "Olive"; buf_reset(err); rc = cs_str_string_plus_equals(cs, name, "hello", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarOlive = cs_subset_string(sub, "Olive"); - TEST_MSG("String: %s = %s\n", name, VarOlive); + TEST_MSG("String: %s = %s", name, VarOlive); name = "Ugli"; buf_reset(err); rc = cs_str_string_set(cs, name, "utf-8", err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -642,11 +642,11 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, NULL, err); if (TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -654,11 +654,11 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "utf-8:us-ascii", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -667,11 +667,11 @@ static bool test_validator(struct ConfigSubset *sub, struct Buffer *err) rc = cs_str_string_set(cs, name, "apple", err); if (TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("Expected error: %s\n", buf_string(err)); + TEST_MSG("Expected error: %s", buf_string(err)); } else { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } @@ -684,8 +684,8 @@ static void dump_native(struct ConfigSet *cs, const char *parent, const char *ch intptr_t pval = cs_str_native_get(cs, parent, NULL); intptr_t cval = cs_str_native_get(cs, child, NULL); - TEST_MSG("%15s = %s\n", parent, (char *) pval); - TEST_MSG("%15s = %s\n", child, (char *) cval); + TEST_MSG("%15s = %s", parent, (char *) pval); + TEST_MSG("%15s = %s", child, (char *) cval); } static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) @@ -705,7 +705,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) struct HashElem *he = cs_subset_create_inheritance(a->sub, parent); if (!he) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } @@ -714,7 +714,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) int rc = cs_str_string_set(cs, parent, "hello", err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -724,7 +724,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_string_set(cs, child, "world", err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -734,7 +734,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, child, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); @@ -744,7 +744,7 @@ static bool test_inherit(struct ConfigSet *cs, struct Buffer *err) rc = cs_str_reset(cs, parent, err); if (CSR_RESULT(rc) != CSR_SUCCESS) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); goto ti_out; } dump_native(cs, parent, child); diff --git a/test/config/subset.c b/test/config/subset.c index da9d356d3..85fd09370 100644 --- a/test/config/subset.c +++ b/test/config/subset.c @@ -73,14 +73,14 @@ void test_config_subset(void) he = cs_subset_lookup(NULL, NULL); if (!TEST_CHECK(he == NULL)) { - TEST_MSG("cs_subset_lookup failed\n"); + TEST_MSG("cs_subset_lookup failed"); return; } he = cs_subset_lookup(n->sub, name); if (!TEST_CHECK(he != NULL)) { - TEST_MSG("cs_subset_lookup failed\n"); + TEST_MSG("cs_subset_lookup failed"); return; } @@ -89,7 +89,7 @@ void test_config_subset(void) rc = cs_subset_he_native_get(NULL, NULL, err); if (!TEST_CHECK(rc == INT_MIN)) { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -97,7 +97,7 @@ void test_config_subset(void) value = cs_subset_he_native_get(n->sub, he, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("cs_subset_he_native_get failed\n"); + TEST_MSG("cs_subset_he_native_get failed"); return; } @@ -105,7 +105,7 @@ void test_config_subset(void) value = cs_subset_str_native_get(n->sub, name, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("cs_subset_str_native_get failed\n"); + TEST_MSG("cs_subset_str_native_get failed"); return; } @@ -113,7 +113,7 @@ void test_config_subset(void) rc = cs_subset_he_native_set(NULL, NULL, value + 100, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("cs_subset_he_native_set failed\n"); + TEST_MSG("cs_subset_he_native_set failed"); return; } @@ -121,7 +121,7 @@ void test_config_subset(void) rc = cs_subset_he_native_set(n->sub, he, value + 100, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("cs_subset_he_native_set failed\n"); + TEST_MSG("cs_subset_he_native_set failed"); return; } @@ -129,7 +129,7 @@ void test_config_subset(void) rc = cs_subset_str_native_set(n->sub, name, value + 100, err); if (!TEST_CHECK(value != INT_MIN)) { - TEST_MSG("cs_subset_str_native_set failed\n"); + TEST_MSG("cs_subset_str_native_set failed"); return; } @@ -146,7 +146,7 @@ void test_config_subset(void) rc = cs_subset_str_string_get(NULL, NULL, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -164,7 +164,7 @@ void test_config_subset(void) rc = cs_subset_he_string_set(NULL, NULL, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -173,7 +173,7 @@ void test_config_subset(void) rc = cs_subset_he_string_set(n->sub, he, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_he_string_set failed\n"); + TEST_MSG("cs_subset_he_string_set failed"); return; } @@ -182,7 +182,7 @@ void test_config_subset(void) rc = cs_subset_str_string_set(n->sub, name, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_str_string_set failed\n"); + TEST_MSG("cs_subset_str_string_set failed"); return; } @@ -191,7 +191,7 @@ void test_config_subset(void) rc = cs_subset_he_string_plus_equals(NULL, NULL, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -200,7 +200,7 @@ void test_config_subset(void) rc = cs_subset_he_string_plus_equals(n->sub, he, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_he_string_plus_equals failed\n"); + TEST_MSG("cs_subset_he_string_plus_equals failed"); return; } @@ -209,7 +209,7 @@ void test_config_subset(void) rc = cs_subset_str_string_plus_equals(n->sub, name, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_str_string_plus_equals failed\n"); + TEST_MSG("cs_subset_str_string_plus_equals failed"); return; } @@ -218,7 +218,7 @@ void test_config_subset(void) rc = cs_subset_he_string_minus_equals(NULL, NULL, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -227,7 +227,7 @@ void test_config_subset(void) rc = cs_subset_he_string_minus_equals(n->sub, he, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_he_string_minus_equals failed\n"); + TEST_MSG("cs_subset_he_string_minus_equals failed"); return; } @@ -236,7 +236,7 @@ void test_config_subset(void) rc = cs_subset_str_string_minus_equals(n->sub, name, expected, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_str_string_minus_equals failed\n"); + TEST_MSG("cs_subset_str_string_minus_equals failed"); return; } @@ -244,7 +244,7 @@ void test_config_subset(void) rc = cs_subset_he_reset(NULL, NULL, err); if (!TEST_CHECK(CSR_RESULT(rc) != CSR_SUCCESS)) { - TEST_MSG("This test should have failed\n"); + TEST_MSG("This test should have failed"); return; } @@ -252,7 +252,7 @@ void test_config_subset(void) rc = cs_subset_he_reset(n->sub, he, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_he_reset failed\n"); + TEST_MSG("cs_subset_he_reset failed"); return; } @@ -260,21 +260,21 @@ void test_config_subset(void) rc = cs_subset_str_reset(n->sub, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_str_reset failed\n"); + TEST_MSG("cs_subset_str_reset failed"); return; } he = cs_subset_lookup(sub_a, name); if (!TEST_CHECK(he != NULL)) { - TEST_MSG("cs_subset_lookup failed\n"); + TEST_MSG("cs_subset_lookup failed"); return; } he = cs_subset_lookup(sub_m, name); if (!TEST_CHECK(he != NULL)) { - TEST_MSG("cs_subset_lookup failed\n"); + TEST_MSG("cs_subset_lookup failed"); return; } @@ -286,28 +286,28 @@ void test_config_subset(void) rc = cs_subset_str_delete(sub_m, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("cs_subset_str_delete failed\n"); + TEST_MSG("cs_subset_str_delete failed"); return; } he = cs_subset_lookup(sub_m, name); if (!TEST_CHECK(he == NULL)) { - TEST_MSG("cs_subset_lookup succeeded\n"); + TEST_MSG("cs_subset_lookup succeeded"); return; } he = cs_subset_lookup(sub_a, name); if (!TEST_CHECK(he != NULL)) { - TEST_MSG("cs_subset_lookup failed\n"); + TEST_MSG("cs_subset_lookup failed"); return; } he = cs_subset_lookup(n->sub, name); if (!TEST_CHECK(he != NULL)) { - TEST_MSG("cs_subset_lookup failed\n"); + TEST_MSG("cs_subset_lookup failed"); return; } diff --git a/test/config/synonym.c b/test/config/synonym.c index f5bc3d098..b572f2b83 100644 --- a/test/config/synonym.c +++ b/test/config/synonym.c @@ -65,17 +65,17 @@ static bool test_string_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_set(cs, name, value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarApple = cs_subset_string(sub, "Apple"); if (!TEST_CHECK_STR_EQ(VarApple, value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %s, set by '%s'\n", name, NONULL(VarApple), value); + TEST_MSG("%s = %s, set by '%s'", name, NONULL(VarApple), value); return true; } @@ -90,11 +90,11 @@ static bool test_string_get(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_string_get(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } const char *VarCherry = cs_subset_string(sub, "Cherry"); - TEST_MSG("%s = '%s', '%s'\n", name, NONULL(VarCherry), buf_string(err)); + TEST_MSG("%s = '%s', '%s'", name, NONULL(VarCherry), buf_string(err)); return true; } @@ -111,17 +111,17 @@ static bool test_native_set(struct ConfigSubset *sub, struct Buffer *err) int rc = cs_str_native_set(cs, name, (intptr_t) value, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } const char *VarElderberry = cs_subset_string(sub, "Elderberry"); if (!TEST_CHECK_STR_EQ(VarElderberry, value)) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("%s = %s, set by '%s'\n", name, NONULL(VarElderberry), value); + TEST_MSG("%s = %s, set by '%s'", name, NONULL(VarElderberry), value); return true; } @@ -141,10 +141,10 @@ static bool test_native_get(struct ConfigSubset *sub, struct Buffer *err) const char *VarGuava = cs_subset_string(sub, "Guava"); if (!TEST_CHECK_STR_EQ(VarGuava, (const char *) value)) { - TEST_MSG("Get failed: %s\n", buf_string(err)); + TEST_MSG("Get failed: %s", buf_string(err)); return false; } - TEST_MSG("%s = '%s', '%s'\n", name, VarGuava, (const char *) value); + TEST_MSG("%s = '%s', '%s'", name, VarGuava, (const char *) value); return true; } @@ -158,28 +158,28 @@ static bool test_reset(struct ConfigSubset *sub, struct Buffer *err) buf_reset(err); const char *VarIlama = cs_subset_string(sub, "Ilama"); - TEST_MSG("Initial: %s = '%s'\n", name, NONULL(VarIlama)); + TEST_MSG("Initial: %s = '%s'", name, NONULL(VarIlama)); int rc = cs_str_string_set(cs, name, "hello", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) return false; - TEST_MSG("Set: %s = '%s'\n", name, VarIlama); + TEST_MSG("Set: %s = '%s'", name, VarIlama); buf_reset(err); rc = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("%s\n", buf_string(err)); + TEST_MSG("%s", buf_string(err)); return false; } VarIlama = cs_subset_string(sub, "Ilama"); if (!TEST_CHECK_STR_EQ(VarIlama, "iguana")) { - TEST_MSG("Value of %s wasn't changed\n", name); + TEST_MSG("Value of %s wasn't changed", name); return false; } - TEST_MSG("Reset: %s = '%s'\n", name, VarIlama); + TEST_MSG("Reset: %s = '%s'", name, VarIlama); return true; } @@ -196,11 +196,11 @@ void test_config_synonym(void) if (cs_register_variables(cs, Vars2, DT_NO_FLAGS)) { - TEST_MSG("Test should have failed\n"); + TEST_MSG("Test should have failed"); return; } - TEST_MSG("Expected error\n"); + TEST_MSG("Expected error"); notify_observer_add(NeoMutt->notify, NT_CONFIG, log_observer, 0); diff --git a/test/config/variable.c b/test/config/variable.c index d2cd8a828..a5e038f04 100644 --- a/test/config/variable.c +++ b/test/config/variable.c @@ -54,7 +54,7 @@ void test_config_variable(void) int result = cs_str_string_set(cs, name, "world", err); if (!TEST_CHECK(CSR_RESULT(result) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } @@ -62,7 +62,7 @@ void test_config_variable(void) result = cs_str_reset(cs, name, err); if (!TEST_CHECK(CSR_RESULT(result) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } @@ -74,7 +74,7 @@ void test_config_variable(void) result = cs_he_string_get(cs, he, err); if (!TEST_CHECK(CSR_RESULT(result) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } @@ -82,7 +82,7 @@ void test_config_variable(void) result = cs_he_native_set(cs, he, IP "foo", err); if (!TEST_CHECK(CSR_RESULT(result) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } @@ -90,7 +90,7 @@ void test_config_variable(void) result = cs_str_native_set(cs, name, IP "bar", err); if (!TEST_CHECK(CSR_RESULT(result) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } @@ -98,7 +98,7 @@ void test_config_variable(void) intptr_t value = cs_he_native_get(cs, he, err); if (!TEST_CHECK_STR_EQ((const char *) value, "bar")) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } @@ -110,14 +110,14 @@ void test_config_variable(void) result = cs_he_string_plus_equals(cs, he, "23", err); if (!TEST_CHECK(CSR_RESULT(result) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } result = cs_he_string_minus_equals(cs, he, "56", err); if (!TEST_CHECK(CSR_RESULT(result) == CSR_SUCCESS)) { - TEST_MSG("Error: %s\n", buf_string(err)); + TEST_MSG("Error: %s", buf_string(err)); return; } diff --git a/test/gui/reflow.c b/test/gui/reflow.c index 63aa4a8e1..d9fa8ab59 100644 --- a/test/gui/reflow.c +++ b/test/gui/reflow.c @@ -113,8 +113,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -140,8 +140,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -173,8 +173,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -212,8 +212,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -252,8 +252,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -288,8 +288,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -322,8 +322,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -368,8 +368,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -402,8 +402,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -433,8 +433,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -472,8 +472,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -508,8 +508,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -544,8 +544,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -583,8 +583,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -622,8 +622,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -661,8 +661,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -700,8 +700,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -732,8 +732,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -759,8 +759,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -792,8 +792,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -831,8 +831,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -871,8 +871,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -907,8 +907,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -941,8 +941,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -987,8 +987,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1021,8 +1021,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1052,8 +1052,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1091,8 +1091,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1127,8 +1127,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1163,8 +1163,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1202,8 +1202,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1241,8 +1241,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1280,8 +1280,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1319,8 +1319,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); @@ -1399,8 +1399,8 @@ void test_window_reflow(void) struct Buffer buf = buf_make(1024); win_serialise(root, &buf); TEST_CHECK_STR_EQ(buf_string(&buf), expected); - TEST_MSG("Expected %s\n", expected); - TEST_MSG("Got %s\n", buf_string(&buf)); + TEST_MSG("Expected %s", expected); + TEST_MSG("Got %s", buf_string(&buf)); buf_dealloc(&buf); mutt_window_free(&root); diff --git a/test/mbyte/mutt_mb_width.c b/test/mbyte/mutt_mb_width.c index 0f7639476..e9c706c72 100644 --- a/test/mbyte/mutt_mb_width.c +++ b/test/mbyte/mutt_mb_width.c @@ -52,8 +52,8 @@ void test_mutt_mb_width(void) int len = mutt_mb_width(str, 0, false); TEST_CHECK(len == 4); - TEST_MSG("Expected: %d\n", 4); - TEST_MSG("Actual: %d\n", len); + TEST_MSG("Expected: %d", 4); + TEST_MSG("Actual: %d", len); } { @@ -76,8 +76,8 @@ void test_mutt_mb_width(void) TEST_CASE(test_name(tests[i].str)); int len = mutt_mb_width(tests[i].str, tests[i].col, false); TEST_CHECK(len == tests[i].len); - TEST_MSG("Expected: %d\n", tests[i].len); - TEST_MSG("Actual: %d\n", len); + TEST_MSG("Expected: %d", tests[i].len); + TEST_MSG("Actual: %d", len); } } @@ -102,8 +102,8 @@ void test_mutt_mb_width(void) TEST_CASE(test_name(tests[i].str)); int len = mutt_mb_width(tests[i].str, tests[i].col, false); TEST_CHECK(len == tests[i].len); - TEST_MSG("Expected: %d\n", tests[i].len); - TEST_MSG("Actual: %d\n", len); + TEST_MSG("Expected: %d", tests[i].len); + TEST_MSG("Actual: %d", len); } } @@ -121,8 +121,8 @@ void test_mutt_mb_width(void) TEST_CASE(test_name(tests[i].str)); int len = mutt_mb_width(tests[i].str, tests[i].col, true); TEST_CHECK(len == tests[i].len); - TEST_MSG("Expected: %d\n", tests[i].len); - TEST_MSG("Actual: %d\n", len); + TEST_MSG("Expected: %d", tests[i].len); + TEST_MSG("Actual: %d", len); } } } diff --git a/test/parse/parse_rc_line.c b/test/parse/parse_rc_line.c index 27b494348..ef3514f37 100644 --- a/test/parse/parse_rc_line.c +++ b/test/parse/parse_rc_line.c @@ -58,7 +58,7 @@ static bool set_non_empty_values(void) int rc = cs_str_reset(NeoMutt->sub->cs, ConfigVars[v].name, err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", ConfigVars[v].name, + TEST_MSG("Failed to set dummy value for %s: %s", ConfigVars[v].name, buf_string(err)); ret = false; } @@ -82,7 +82,7 @@ static bool set_empty_values(void) rc = cs_str_string_set(NeoMutt->sub->cs, "Apple", "no", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "Apple", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "Apple", buf_string(err)); ret = false; } @@ -90,7 +90,7 @@ static bool set_empty_values(void) rc = cs_str_string_set(NeoMutt->sub->cs, "Banana", "no", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "Banana", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "Banana", buf_string(err)); ret = false; } @@ -98,7 +98,7 @@ static bool set_empty_values(void) rc = cs_str_string_set(NeoMutt->sub->cs, "Cherry", "0", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "Cherry", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "Cherry", buf_string(err)); ret = false; } @@ -114,7 +114,7 @@ static bool set_empty_values(void) rc = cs_str_string_set(NeoMutt->sub->cs, stringlike[i], "", err); if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", stringlike[i], buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", stringlike[i], buf_string(err)); ret = false; } } @@ -157,7 +157,7 @@ static bool test_set(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -167,12 +167,12 @@ static bool test_set(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, boolish[v], err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", boolish[v], buf_string(err)); + TEST_MSG("Failed to get %s: %s", boolish[v], buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, "yes")) { - TEST_MSG("Variable not set %s: %s\n", boolish[v], buf_string(err)); + TEST_MSG("Variable not set %s: %s", boolish[v], buf_string(err)); return false; } } @@ -185,7 +185,7 @@ static bool test_set(struct Buffer *err) enum CommandResult rc = parse_rc_line("set Damson = newfoo", err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -195,12 +195,12 @@ static bool test_set(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, "Damson", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", "Damson", buf_string(err)); + TEST_MSG("Failed to get %s: %s", "Damson", buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, "newfoo")) { - TEST_MSG("Variable not set %s: %s\n", "Damson", buf_string(err)); + TEST_MSG("Variable not set %s: %s", "Damson", buf_string(err)); return false; } } @@ -214,7 +214,7 @@ static bool test_set(struct Buffer *err) enum CommandResult rc = parse_rc_line("set my_var = newbar", err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -224,12 +224,12 @@ static bool test_set(struct Buffer *err) grc = cs_str_string_get(NeoMutt->sub->cs, "my_var", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Failed to get %s: %s", "my_var", buf_string(err)); return false; } if (!TEST_CHECK(mutt_str_equal(err->data, "newbar"))) { - TEST_MSG("Variable not set %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Variable not set %s: %s", "my_var", buf_string(err)); return false; } } @@ -240,7 +240,7 @@ static bool test_set(struct Buffer *err) enum CommandResult rc = parse_rc_line("set zzz = newbaz", err); if (!TEST_CHECK(rc == MUTT_CMD_ERROR)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_ERROR, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_ERROR, rc, buf_string(err)); return false; } @@ -284,7 +284,7 @@ static bool test_unset(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -294,12 +294,12 @@ static bool test_unset(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, boolish[v], err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", boolish[v], buf_string(err)); + TEST_MSG("Failed to get %s: %s", boolish[v], buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, "no")) { - TEST_MSG("Variable not unset %s: %s\n", boolish[v], buf_string(err)); + TEST_MSG("Variable not unset %s: %s", boolish[v], buf_string(err)); return false; } } @@ -312,7 +312,7 @@ static bool test_unset(struct Buffer *err) enum CommandResult rc = parse_rc_line("unset Cherry", err); if (!TEST_CHECK(rc == MUTT_CMD_ERROR)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_ERROR, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_ERROR, rc, buf_string(err)); return false; } @@ -324,7 +324,7 @@ static bool test_unset(struct Buffer *err) enum CommandResult rc = parse_rc_line("unset Damson", err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -334,12 +334,12 @@ static bool test_unset(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, "Damson", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", "Damson", buf_string(err)); + TEST_MSG("Failed to get %s: %s", "Damson", buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, "")) { - TEST_MSG("Variable not unset %s: %s\n", "Damson", buf_string(err)); + TEST_MSG("Variable not unset %s: %s", "Damson", buf_string(err)); return false; } } @@ -358,7 +358,7 @@ static bool test_unset(struct Buffer *err) int grc = cs_str_string_set(NeoMutt->sub->cs, "my_var", "foo", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "my_var", buf_string(err)); return false; } @@ -366,7 +366,7 @@ static bool test_unset(struct Buffer *err) enum CommandResult rc = parse_rc_line("unset my_var", err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -376,7 +376,7 @@ static bool test_unset(struct Buffer *err) grc = cs_str_string_get(NeoMutt->sub->cs, "my_var", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_ERR_UNKNOWN)) { - TEST_MSG("my_var was not an unknown config variable: %s\n", buf_string(err)); + TEST_MSG("my_var was not an unknown config variable: %s", buf_string(err)); return false; } } @@ -387,7 +387,7 @@ static bool test_unset(struct Buffer *err) enum CommandResult rc = parse_rc_line("unset zzz", err); if (!TEST_CHECK(rc == MUTT_CMD_ERROR)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_ERROR, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_ERROR, rc, buf_string(err)); return false; } @@ -425,7 +425,7 @@ static bool test_reset(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -435,20 +435,20 @@ static bool test_reset(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, ConfigVars[v].name, err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", ConfigVars[v].name, buf_string(err)); + TEST_MSG("Failed to get %s: %s", ConfigVars[v].name, buf_string(err)); return false; } struct Buffer *buf = buf_pool_get(); grc = cs_str_initial_get(NeoMutt->sub->cs, ConfigVars[v].name, buf); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", ConfigVars[v].name, buf_string(buf)); + TEST_MSG("Failed to get %s: %s", ConfigVars[v].name, buf_string(buf)); buf_pool_release(&buf); return false; } if (!TEST_CHECK_STR_EQ(err->data, buf->data)) { - TEST_MSG("Variable not reset %s: %s != %s\n", ConfigVars[v].name, + TEST_MSG("Variable not reset %s: %s != %s", ConfigVars[v].name, buf_string(err), buf_string(buf)); buf_pool_release(&buf); return false; @@ -472,7 +472,7 @@ static bool test_reset(struct Buffer *err) int grc = cs_str_string_set(NeoMutt->sub->cs, "my_var", "foo", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "my_var", buf_string(err)); return false; } @@ -480,7 +480,7 @@ static bool test_reset(struct Buffer *err) enum CommandResult rc = parse_rc_line("reset my_var", err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -490,7 +490,7 @@ static bool test_reset(struct Buffer *err) grc = cs_str_string_get(NeoMutt->sub->cs, "my_var", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_ERR_UNKNOWN)) { - TEST_MSG("my_var was not an unknown config variable: %s\n", buf_string(err)); + TEST_MSG("my_var was not an unknown config variable: %s", buf_string(err)); return false; } } @@ -514,7 +514,7 @@ static bool test_reset(struct Buffer *err) int grc = cs_str_string_set(NeoMutt->sub->cs, "my_var", "foo", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "my_var", buf_string(err)); return false; } @@ -522,7 +522,7 @@ static bool test_reset(struct Buffer *err) enum CommandResult rc = parse_rc_line("reset all", err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, rc, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -534,20 +534,20 @@ static bool test_reset(struct Buffer *err) grc = cs_str_string_get(NeoMutt->sub->cs, ConfigVars[v].name, err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", ConfigVars[v].name, buf_string(err)); + TEST_MSG("Failed to get %s: %s", ConfigVars[v].name, buf_string(err)); return false; } struct Buffer *buf = buf_pool_get(); grc = cs_str_initial_get(NeoMutt->sub->cs, ConfigVars[v].name, buf); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", ConfigVars[v].name, buf_string(buf)); + TEST_MSG("Failed to get %s: %s", ConfigVars[v].name, buf_string(buf)); buf_pool_release(&buf); return false; } if (!TEST_CHECK(mutt_str_equal(err->data, buf->data))) { - TEST_MSG("Variable not reset %s: %s != %s\n", ConfigVars[v].name, + TEST_MSG("Variable not reset %s: %s != %s", ConfigVars[v].name, buf_string(err), buf_string(buf)); buf_pool_release(&buf); return false; @@ -559,7 +559,7 @@ static bool test_reset(struct Buffer *err) grc = cs_str_string_get(NeoMutt->sub->cs, "my_var", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_ERR_UNKNOWN)) { - TEST_MSG("my_var was not an unknown config variable: expected = %d, got = %d, err = %s\n", + TEST_MSG("my_var was not an unknown config variable: expected = %d, got = %d, err = %s", CSR_ERR_UNKNOWN, CSR_RESULT(grc), buf_string(err)); return false; } @@ -612,7 +612,7 @@ static bool test_toggle(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -622,12 +622,12 @@ static bool test_toggle(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, boolish[v], err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", boolish[v], buf_string(err)); + TEST_MSG("Failed to get %s: %s", boolish[v], buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, expected1[v])) { - TEST_MSG("Variable %s not toggled off: got = %s, expected = %s\n", + TEST_MSG("Variable %s not toggled off: got = %s, expected = %s", boolish[v], err->data, expected1[v], buf_string(err)); return false; } @@ -641,7 +641,7 @@ static bool test_toggle(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -651,12 +651,12 @@ static bool test_toggle(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, boolish[v], err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", boolish[v], buf_string(err)); + TEST_MSG("Failed to get %s: %s", boolish[v], buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, expected2[v])) { - TEST_MSG("Variable %s not toggled on: got = %s, expected = %s\n", + TEST_MSG("Variable %s not toggled on: got = %s, expected = %s", boolish[v], err->data, expected2[v], buf_string(err)); return false; } @@ -701,7 +701,7 @@ static bool test_query(struct Buffer *err) int grc = cs_str_string_set(NeoMutt->sub->cs, "my_var", "foo", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "my_var", buf_string(err)); return false; } @@ -719,7 +719,7 @@ static bool test_query(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -728,7 +728,7 @@ static bool test_query(struct Buffer *err) snprintf(line, sizeof(line), "%s=\"%s\"", vars[v], expected[v]); if (!TEST_CHECK_STR_EQ(err->data, line)) { - TEST_MSG("Variable query failed for %s: got = %s, expected = %s\n", + TEST_MSG("Variable query failed for %s: got = %s, expected = %s", vars[v], buf_string(err), line); return false; } @@ -746,7 +746,7 @@ static bool test_query(struct Buffer *err) int grc = cs_str_string_set(NeoMutt->sub->cs, "my_var", "foo", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "my_var", buf_string(err)); return false; } @@ -768,7 +768,7 @@ static bool test_query(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -777,7 +777,7 @@ static bool test_query(struct Buffer *err) snprintf(line, sizeof(line), "%s=\"%s\"", vars[v], expected[v]); if (!TEST_CHECK_STR_EQ(err->data, line)) { - TEST_MSG("Variable query failed for %s: got = %s, expected = %s\n", + TEST_MSG("Variable query failed for %s: got = %s, expected = %s", vars[v], buf_string(err), line); return false; } @@ -803,7 +803,7 @@ static bool test_increment(struct Buffer *err) int grc = cs_str_string_set(NeoMutt->sub->cs, "my_var", "foo", err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to set dummy value for %s: %s\n", "my_var", buf_string(err)); + TEST_MSG("Failed to set dummy value for %s: %s", "my_var", buf_string(err)); return false; } @@ -832,7 +832,7 @@ static bool test_increment(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -842,12 +842,12 @@ static bool test_increment(struct Buffer *err) grc = cs_str_string_get(NeoMutt->sub->cs, vars[v], err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", vars[v], buf_string(err)); + TEST_MSG("Failed to get %s: %s", vars[v], buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, expected[v])) { - TEST_MSG("Variable not incremented %s: got = %s, expected = %s\n", + TEST_MSG("Variable not incremented %s: got = %s, expected = %s", vars[v], buf_string(err), expected[v]); return false; } @@ -889,7 +889,7 @@ static bool test_decrement(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -899,12 +899,12 @@ static bool test_decrement(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, vars[v], err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", vars[v], buf_string(err)); + TEST_MSG("Failed to get %s: %s", vars[v], buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, expected[v])) { - TEST_MSG("Variable not decremented %s: got = %s, expected = %s\n", + TEST_MSG("Variable not decremented %s: got = %s, expected = %s", vars[v], buf_string(err), expected[v]); return false; } @@ -938,7 +938,7 @@ static bool test_invalid_syntax(struct Buffer *err) enum CommandResult rc = parse_rc_line(template[t], err); if (!TEST_CHECK(rc == MUTT_CMD_WARNING || rc == MUTT_CMD_ERROR)) { - TEST_MSG("For command '%s': Expected %d or %d, but got %d; err is: '%s'\n", + TEST_MSG("For command '%s': Expected %d or %d, but got %d; err is: '%s'", template[t], MUTT_CMD_WARNING, MUTT_CMD_ERROR, rc, buf_string(err)); return false; } @@ -981,7 +981,7 @@ static bool test_path_expanding(struct Buffer *err) enum CommandResult rc = parse_rc_line(line, err); if (!TEST_CHECK(rc == MUTT_CMD_SUCCESS)) { - TEST_MSG("Expected %d, but got %d; err is: '%s'\n", MUTT_CMD_SUCCESS, + TEST_MSG("Expected %d, but got %d; err is: '%s'", MUTT_CMD_SUCCESS, rc, buf_string(err)); return false; } @@ -991,12 +991,12 @@ static bool test_path_expanding(struct Buffer *err) int grc = cs_str_string_get(NeoMutt->sub->cs, pathlike[v], err); if (!TEST_CHECK(CSR_RESULT(grc) == CSR_SUCCESS)) { - TEST_MSG("Failed to get %s: %s\n", pathlike[v], buf_string(err)); + TEST_MSG("Failed to get %s: %s", pathlike[v], buf_string(err)); return false; } if (!TEST_CHECK_STR_EQ(err->data, expected[v])) { - TEST_MSG("Variable not incremented %s: got = %s, expected = %s\n", + TEST_MSG("Variable not incremented %s: got = %s, expected = %s", pathlike[v], buf_string(err), expected[v]); return false; } @@ -1010,7 +1010,7 @@ void test_command_set(void) { if (!TEST_CHECK(cs_register_variables(NeoMutt->sub->cs, ConfigVars, DT_NO_FLAGS))) { - TEST_MSG("Failed to register config variables\n"); + TEST_MSG("Failed to register config variables"); return; } diff --git a/test/pattern/comp.c b/test/pattern/comp.c index 0f068ae9d..4be9c869b 100644 --- a/test/pattern/comp.c +++ b/test/pattern/comp.c @@ -268,9 +268,9 @@ void test_mutt_pattern_comp(void) { char s2[1024]; canonical_pattern(s2, &expected, 0); - TEST_MSG("Expected:\n%s", s2); + TEST_MSG("Expected:%s", s2); canonical_pattern(s2, pat, 0); - TEST_MSG("Actual:\n%s", s2); + TEST_MSG("Actual:%s", s2); } char *msg = ""; @@ -310,9 +310,9 @@ void test_mutt_pattern_comp(void) { char s2[1024]; canonical_pattern(s2, &expected, 0); - TEST_MSG("Expected:\n%s", s2); + TEST_MSG("Expected:%s", s2); canonical_pattern(s2, pat, 0); - TEST_MSG("Actual:\n%s", s2); + TEST_MSG("Actual:%s", s2); } char *msg = ""; @@ -383,9 +383,9 @@ void test_mutt_pattern_comp(void) { char s2[1024]; canonical_pattern(s2, &expected, 0); - TEST_MSG("Expected:\n%s", s2); + TEST_MSG("Expected:%s", s2); canonical_pattern(s2, pat, 0); - TEST_MSG("Actual:\n%s", s2); + TEST_MSG("Actual:%s", s2); } char *msg = ""; @@ -456,9 +456,9 @@ void test_mutt_pattern_comp(void) { char s2[1024]; canonical_pattern(s2, &expected, 0); - TEST_MSG("Expected:\n%s", s2); + TEST_MSG("Expected:%s", s2); canonical_pattern(s2, pat, 0); - TEST_MSG("Actual:\n%s", s2); + TEST_MSG("Actual:%s", s2); } char *msg = ""; @@ -529,9 +529,9 @@ void test_mutt_pattern_comp(void) { char s2[1024]; canonical_pattern(s2, &expected, 0); - TEST_MSG("Expected:\n%s", s2); + TEST_MSG("Expected:%s", s2); canonical_pattern(s2, pat, 0); - TEST_MSG("Actual:\n%s", s2); + TEST_MSG("Actual:%s", s2); } char *msg = ""; @@ -615,9 +615,9 @@ void test_mutt_pattern_comp(void) { char s2[1024]; canonical_pattern(s2, &expected, 0); - TEST_MSG("Expected:\n%s", s2); + TEST_MSG("Expected:%s", s2); canonical_pattern(s2, pat, 0); - TEST_MSG("Actual:\n%s", s2); + TEST_MSG("Actual:%s", s2); } char *msg = ""; @@ -716,9 +716,9 @@ void test_mutt_pattern_comp(void) { char s2[1024]; canonical_pattern(s2, &expected, 0); - TEST_MSG("Expected:\n%s", s2); + TEST_MSG("Expected:%s", s2); canonical_pattern(s2, pat, 0); - TEST_MSG("Actual:\n%s", s2); + TEST_MSG("Actual:%s", s2); } char *msg = ""; diff --git a/test/string/mutt_str_sysexit.c b/test/string/mutt_str_sysexit.c index 729141201..583c11a62 100644 --- a/test/string/mutt_str_sysexit.c +++ b/test/string/mutt_str_sysexit.c @@ -66,7 +66,7 @@ void test_mutt_str_sysexit(void) for (size_t i = 0; i < mutt_array_size(tests); i++) { - TEST_MSG("Testing %d, expecting '%s'\n", tests[i].err_num, NONULL(tests[i].result)); + TEST_MSG("Testing %d, expecting '%s'", tests[i].err_num, NONULL(tests[i].result)); result = mutt_str_sysexit(tests[i].err_num); TEST_CHECK_STR_EQ(result, tests[i].result); -- cgit v1.2.3