units: tidy up begin/end blocks

- use `UNITTEST_BEGIN_SIMPLE`/`UNITTEST_END_SIMPLE` where missing.
- drop redundant `(void)arg;` where using `UNITTEST_BEGIN*`.
- unit1636: drop redundant block after `UNITTEST_BEGIN*`.
- unit1609: fix typo in comment.
- unit1627: merge to `if`s.

Closes #21715
This commit is contained in:
Viktor Szakats 2026-05-21 04:21:33 +02:00
parent a076f821e1
commit bb5500a752
No known key found for this signature in database
8 changed files with 56 additions and 61 deletions

View file

@ -36,6 +36,8 @@ struct check1625 {
static CURLcode test_unit1625(const char *arg) static CURLcode test_unit1625(const char *arg)
{ {
UNITTEST_BEGIN_SIMPLE
size_t i; size_t i;
static const struct check1625 list[] = { static const struct check1625 list[] = {
/* basic case */ /* basic case */
@ -101,7 +103,6 @@ static CURLcode test_unit1625(const char *arg)
/* hyphenated second token */ /* hyphenated second token */
{ "Encoding: extra-good, super-nice", "Encoding:", "super-nice", TRUE }, { "Encoding: extra-good, super-nice", "Encoding:", "super-nice", TRUE },
}; };
(void)arg;
for(i = 0; i < CURL_ARRAYSIZE(list); i++) { for(i = 0; i < CURL_ARRAYSIZE(list); i++) {
bool check = Curl_compareheader(list[i].in, bool check = Curl_compareheader(list[i].in,
@ -123,12 +124,12 @@ static CURLcode test_unit1625(const char *arg)
if(i != CURL_ARRAYSIZE(list)) if(i != CURL_ARRAYSIZE(list))
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
return CURLE_OK; UNITTEST_END_SIMPLE
} }
#else /* CURL_DISABLE_HTTP */ #else /* CURL_DISABLE_HTTP */
static CURLcode test_unit1625(const char *arg) static CURLcode test_unit1625(const char *arg)
{ {
(void)arg; UNITTEST_BEGIN_SIMPLE
return CURLE_OK; UNITTEST_END_SIMPLE
} }
#endif #endif

View file

@ -34,6 +34,8 @@ struct check1626 {
static CURLcode test_unit1626(const char *arg) static CURLcode test_unit1626(const char *arg)
{ {
UNITTEST_BEGIN_SIMPLE
size_t i; size_t i;
static const struct check1626 list[] = { static const struct check1626 list[] = {
/* basic */ /* basic */
@ -94,8 +96,6 @@ static CURLcode test_unit1626(const char *arg)
{ "Header : value", "value" }, { "Header : value", "value" },
}; };
(void)arg;
for(i = 0; i < CURL_ARRAYSIZE(list); i++) { for(i = 0; i < CURL_ARRAYSIZE(list); i++) {
bool ok; bool ok;
char *get = Curl_copy_header_value(list[i].in); char *get = Curl_copy_header_value(list[i].in);
@ -117,13 +117,13 @@ static CURLcode test_unit1626(const char *arg)
if(i != CURL_ARRAYSIZE(list)) if(i != CURL_ARRAYSIZE(list))
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
return CURLE_OK; UNITTEST_END_SIMPLE
} }
#else #else
/* for HTTP-disabled builds */ /* for HTTP-disabled builds */
static CURLcode test_unit1626(const char *arg) static CURLcode test_unit1626(const char *arg)
{ {
(void)arg; UNITTEST_BEGIN_SIMPLE
return CURLE_OK; UNITTEST_END_SIMPLE
} }
#endif #endif

View file

@ -28,6 +28,8 @@
static CURLcode test_unit1627(const char *arg) static CURLcode test_unit1627(const char *arg)
{ {
UNITTEST_BEGIN_SIMPLE
size_t i, j; size_t i, j;
/* existing schemes in different cases */ /* existing schemes in different cases */
static const char *okay[] = { static const char *okay[] = {
@ -65,8 +67,6 @@ static CURLcode test_unit1627(const char *arg)
"GhJk", "LzXc", "VbNm" "GhJk", "LzXc", "VbNm"
}; };
(void)arg;
for(i = 0; i < CURL_ARRAYSIZE(okay); i++) { for(i = 0; i < CURL_ARRAYSIZE(okay); i++) {
char buffer[32]; char buffer[32];
const struct Curl_scheme *get = Curl_get_scheme(okay[i]); const struct Curl_scheme *get = Curl_get_scheme(okay[i]);
@ -96,10 +96,9 @@ static CURLcode test_unit1627(const char *arg)
curl_mprintf("%zu invokes\n", i + j); curl_mprintf("%zu invokes\n", i + j);
if(i != CURL_ARRAYSIZE(okay)) if(i != CURL_ARRAYSIZE(okay) ||
return CURLE_FAILED_INIT; j != CURL_ARRAYSIZE(notokay))
if(j != CURL_ARRAYSIZE(notokay))
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
return CURLE_OK; UNITTEST_END_SIMPLE
} }

View file

@ -27,7 +27,7 @@
static CURLcode test_unit1636(const char *arg) static CURLcode test_unit1636(const char *arg)
{ {
UNITTEST_BEGIN_SIMPLE UNITTEST_BEGIN_SIMPLE
{
char buffer[9]; char buffer[9];
curl_off_t secs; curl_off_t secs;
int i; int i;
@ -69,14 +69,14 @@ static CURLcode test_unit1636(const char *arg)
curl_mprintf("^^ was too long!\n"); curl_mprintf("^^ was too long!\n");
} }
} }
}
UNITTEST_END(curl_global_cleanup()) UNITTEST_END(curl_global_cleanup())
} }
#else /* CURL_DISABLE_PROGRESS_METER */ #else /* CURL_DISABLE_PROGRESS_METER */
static CURLcode test_unit1636(const char *arg) static CURLcode test_unit1636(const char *arg)
{ {
(void)arg; UNITTEST_BEGIN_SIMPLE
return CURLE_OK; UNITTEST_END_SIMPLE
} }
#endif #endif

View file

@ -27,7 +27,6 @@
static CURLcode test_unit1675(const char *arg) static CURLcode test_unit1675(const char *arg)
{ {
(void)arg;
UNITTEST_BEGIN_SIMPLE UNITTEST_BEGIN_SIMPLE
/* Test ipv4_normalize */ /* Test ipv4_normalize */

View file

@ -154,11 +154,9 @@ static CURLcode test_unit3300(const char *arg)
} }
#else #else
static CURLcode test_unit3300(const char *arg) static CURLcode test_unit3300(const char *arg)
{ {
UNITTEST_BEGIN_SIMPLE UNITTEST_BEGIN_SIMPLE
(void)arg;
UNITTEST_END_SIMPLE UNITTEST_END_SIMPLE
} }
#endif /* USE_THREADS */ #endif /* USE_THREADS */

View file

@ -134,11 +134,9 @@ static CURLcode test_unit3301(const char *arg)
} }
#else #else
static CURLcode test_unit3301(const char *arg) static CURLcode test_unit3301(const char *arg)
{ {
UNITTEST_BEGIN_SIMPLE UNITTEST_BEGIN_SIMPLE
(void)arg;
UNITTEST_END_SIMPLE UNITTEST_END_SIMPLE
} }
#endif /* USE_THREADS */ #endif /* USE_THREADS */