From 84a246c6ee5b659995c0a5a2610c3d15d27c8aea Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 7 Jun 2019 00:22:12 +0100 Subject: [PATCH] test: tidy code - clang-format - remove notes --- test/buffer/mutt_buffer_concat_path.c | 4 ++-- test/buffer/mutt_buffer_increase_size.c | 3 --- test/config/common.c | 3 ++- test/config/dump.c | 6 ++++-- test/date/mutt_date_local_tz.c | 1 - test/date/mutt_date_make_time.c | 5 +++-- test/list/mutt_list_insert_after.c | 3 ++- test/list/mutt_list_match.c | 1 - test/string/mutt_str_is_ascii.c | 2 ++ test/string/mutt_str_split.c | 2 -- test/string/mutt_str_strcasestr.c | 5 ----- test/string/mutt_str_strdup.c | 1 - test/string/mutt_str_strfcpy.c | 3 --- test/string/mutt_str_strnfcpy.c | 4 ---- test/string/mutt_str_substr_cpy.c | 2 ++ test/string/mutt_str_substr_dup.c | 2 ++ 16 files changed, 19 insertions(+), 28 deletions(-) diff --git a/test/buffer/mutt_buffer_concat_path.c b/test/buffer/mutt_buffer_concat_path.c index 74aa8429f..ce2040d92 100644 --- a/test/buffer/mutt_buffer_concat_path.c +++ b/test/buffer/mutt_buffer_concat_path.c @@ -56,7 +56,8 @@ void test_mutt_buffer_concat_path(void) { for (size_t i = 0; i < mutt_array_size(concat_test); i++) { - TEST_CASE_("DIR: '%s' FILE: '%s'", NONULL(concat_test[i][0]), NONULL(concat_test[i][1])); + TEST_CASE_("DIR: '%s' FILE: '%s'", NONULL(concat_test[i][0]), + NONULL(concat_test[i][1])); { struct Buffer *buf = mutt_buffer_new(); mutt_buffer_concat_path(buf, concat_test[i][0], concat_test[i][1]); @@ -91,4 +92,3 @@ void test_mutt_buffer_concat_path(void) } } } - diff --git a/test/buffer/mutt_buffer_increase_size.c b/test/buffer/mutt_buffer_increase_size.c index 8bea75381..45435d1ac 100644 --- a/test/buffer/mutt_buffer_increase_size.c +++ b/test/buffer/mutt_buffer_increase_size.c @@ -53,8 +53,5 @@ void test_mutt_buffer_increase_size(void) TEST_CHECK(buf->dsize == MAX(orig_size, sizes[i])); mutt_buffer_free(&buf); } - } - - } diff --git a/test/config/common.c b/test/config/common.c index de07ad011..f7e8dcc57 100644 --- a/test/config/common.c +++ b/test/config/common.c @@ -103,7 +103,8 @@ int log_observer(struct NotifyCallback *nc) else cs_he_initial_get(ec->cs, ec->he, &result); - TEST_MSG("Event: %s has been %s to '%s'\n", ec->name, events[nc->event_type - 1], result.data); + TEST_MSG("Event: %s has been %s to '%s'\n", ec->name, + events[nc->event_type - 1], result.data); FREE(&result.data); return true; diff --git a/test/config/dump.c b/test/config/dump.c index 039b857b7..c297211ad 100644 --- a/test/config/dump.c +++ b/test/config/dump.c @@ -370,8 +370,10 @@ bool test_dump_config(void) TEST_CHECK(dump_config(cs, CS_DUMP_STYLE_MUTT, CS_DUMP_NO_FLAGS, fp)); TEST_CHECK(dump_config(cs, CS_DUMP_STYLE_NEO, CS_DUMP_NO_FLAGS, fp)); - TEST_CHECK(dump_config(cs, CS_DUMP_STYLE_NEO, CS_DUMP_ONLY_CHANGED | CS_DUMP_HIDE_SENSITIVE, fp)); - TEST_CHECK(dump_config(cs, CS_DUMP_STYLE_NEO, CS_DUMP_HIDE_VALUE | CS_DUMP_SHOW_DEFAULTS, fp)); + TEST_CHECK(dump_config(cs, CS_DUMP_STYLE_NEO, + CS_DUMP_ONLY_CHANGED | CS_DUMP_HIDE_SENSITIVE, fp)); + TEST_CHECK(dump_config(cs, CS_DUMP_STYLE_NEO, + CS_DUMP_HIDE_VALUE | CS_DUMP_SHOW_DEFAULTS, fp)); struct ConfigSet *cs_bad = cs_new(30); TEST_CHECK(dump_config(cs_bad, CS_DUMP_STYLE_NEO, CS_DUMP_NO_FLAGS, fp)); diff --git a/test/date/mutt_date_local_tz.c b/test/date/mutt_date_local_tz.c index cae8ee435..43597b55e 100644 --- a/test/date/mutt_date_local_tz.c +++ b/test/date/mutt_date_local_tz.c @@ -30,7 +30,6 @@ void test_mutt_date_local_tz(void) { // time_t mutt_date_local_tz(time_t t); - TEST_CHECK(mutt_date_local_tz(TIME_T_MIN) == 0); TEST_CHECK(mutt_date_local_tz(TIME_T_MAX) == 0); diff --git a/test/date/mutt_date_make_time.c b/test/date/mutt_date_make_time.c index 034d53584..5fca7ce71 100644 --- a/test/date/mutt_date_make_time.c +++ b/test/date/mutt_date_make_time.c @@ -59,8 +59,9 @@ void test_mutt_date_make_time(void) { struct tm *tm = &time_tests[i].tm; - TEST_CASE_("{%d,%d,%d,%d,%d,%d,%d} = %ld", tm->tm_sec, tm->tm_min, tm->tm_hour, - tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday, time_tests[i].expected); + TEST_CASE_("{%d,%d,%d,%d,%d,%d,%d} = %ld", tm->tm_sec, tm->tm_min, + tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday, + time_tests[i].expected); time_t result = mutt_date_make_time(&time_tests[i].tm, false); TEST_CHECK(result == time_tests[i].expected); diff --git a/test/list/mutt_list_insert_after.c b/test/list/mutt_list_insert_after.c index edf263126..f198a1996 100644 --- a/test/list/mutt_list_insert_after.c +++ b/test/list/mutt_list_insert_after.c @@ -80,7 +80,8 @@ void test_mutt_list_insert_after(void) char *insert = "Zelda"; struct ListHead start = test_list_create(start_names, false); struct ListHead expected = test_list_create(expected_names, false); - struct ListNode *after = STAILQ_NEXT(STAILQ_NEXT(STAILQ_FIRST(&start), entries), entries); + struct ListNode *after = + STAILQ_NEXT(STAILQ_NEXT(STAILQ_FIRST(&start), entries), entries); TEST_CHECK(mutt_list_insert_after(&start, after, insert) != NULL); TEST_CHECK(mutt_list_compare(&start, &expected) == true); mutt_list_clear(&start); diff --git a/test/list/mutt_list_match.c b/test/list/mutt_list_match.c index a106565b1..a6cd56413 100644 --- a/test/list/mutt_list_match.c +++ b/test/list/mutt_list_match.c @@ -86,5 +86,4 @@ void test_mutt_list_match(void) TEST_CHECK(mutt_list_match(search, &lh) == true); mutt_list_clear(&lh); } - } diff --git a/test/string/mutt_str_is_ascii.c b/test/string/mutt_str_is_ascii.c index e78648159..3e0eb556d 100644 --- a/test/string/mutt_str_is_ascii.c +++ b/test/string/mutt_str_is_ascii.c @@ -36,6 +36,7 @@ void test_mutt_str_is_ascii(void) { // bool mutt_str_is_ascii(const char *p, size_t len); + // clang-format off struct IsAsciiTest ascii_tests[] = { { NULL, 10, true }, @@ -48,6 +49,7 @@ void test_mutt_str_is_ascii(void) { "apple\200", 6, false }, { "apple\200", 5, true }, }; + // clang-format on { for (size_t i = 0; i < mutt_array_size(ascii_tests); i++) diff --git a/test/string/mutt_str_split.c b/test/string/mutt_str_split.c index 747ed4371..f2fc0f611 100644 --- a/test/string/mutt_str_split.c +++ b/test/string/mutt_str_split.c @@ -131,6 +131,4 @@ void test_mutt_str_split(void) mutt_list_clear(&expectedval5); mutt_list_clear(&expectedval6); } - // move to list? - } diff --git a/test/string/mutt_str_strcasestr.c b/test/string/mutt_str_strcasestr.c index d56a96c78..ca521b26d 100644 --- a/test/string/mutt_str_strcasestr.c +++ b/test/string/mutt_str_strcasestr.c @@ -119,9 +119,4 @@ void test_mutt_str_strcasestr(void) TEST_CHECK_(retval == NULL, "Expected: %s, Actual: %s", NULL, retval); } - // null - // no match - // one match: start,middle,end - // multi-matches - } diff --git a/test/string/mutt_str_strdup.c b/test/string/mutt_str_strdup.c index 0ee4b4928..facb91ca0 100644 --- a/test/string/mutt_str_strdup.c +++ b/test/string/mutt_str_strdup.c @@ -46,4 +46,3 @@ void test_mutt_str_strdup(void) FREE(&result); } } - diff --git a/test/string/mutt_str_strfcpy.c b/test/string/mutt_str_strfcpy.c index ca8209b54..20f83eec6 100644 --- a/test/string/mutt_str_strfcpy.c +++ b/test/string/mutt_str_strfcpy.c @@ -76,7 +76,4 @@ void test_mutt_str_strfcpy(void) TEST_MSG("Actual : %zu", len); } } - // buf: null empty normal - // str: null empty normal - } diff --git a/test/string/mutt_str_strnfcpy.c b/test/string/mutt_str_strnfcpy.c index cd2e69c5b..a4c35f00b 100644 --- a/test/string/mutt_str_strnfcpy.c +++ b/test/string/mutt_str_strnfcpy.c @@ -101,8 +101,4 @@ void test_mutt_str_strnfcpy(void) TEST_MSG("Actual : %s", big); } } - // buf: null empty normal - // str: null empty normal - // limit - } diff --git a/test/string/mutt_str_substr_cpy.c b/test/string/mutt_str_substr_cpy.c index aa003122e..1ce549794 100644 --- a/test/string/mutt_str_substr_cpy.c +++ b/test/string/mutt_str_substr_cpy.c @@ -29,7 +29,9 @@ void test_mutt_str_substr_cpy(void) { // char *mutt_str_substr_cpy(char *dest, const char *begin, const char *end, size_t destlen); + // clang-format off const char *str = "apple banana\0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; + // clang-format on { TEST_CHECK(mutt_str_substr_cpy(NULL, str + 3, str + 7, 32) == NULL); diff --git a/test/string/mutt_str_substr_dup.c b/test/string/mutt_str_substr_dup.c index 08d7dd176..38e339730 100644 --- a/test/string/mutt_str_substr_dup.c +++ b/test/string/mutt_str_substr_dup.c @@ -29,7 +29,9 @@ void test_mutt_str_substr_dup(void) { // char *mutt_str_substr_dup(const char *begin, const char *end); + // clang-format off const char *str = "apple banana\0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; + // clang-format on { TEST_CHECK(mutt_str_substr_dup(NULL, str + 7) == NULL); -- 2.40.0