tests(g_strtrim): string copy is not necessary here

This commit is contained in:
Koichiro IWAO 2021-10-12 17:39:27 +09:00
parent fa3beb3694
commit ed2fb6d739

View File

@ -328,8 +328,7 @@ END_TEST
START_TEST(test_strtrim__trim_left) START_TEST(test_strtrim__trim_left)
{ {
/* setup */ /* setup */
const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; char output[] = "\t\t \tDone is better than perfect.\t\t \n\n";
char *output = g_strdup(input);
/* test */ /* test */
g_strtrim(output, 1); g_strtrim(output, 1);
@ -342,8 +341,7 @@ END_TEST
START_TEST(test_strtrim__trim_right) START_TEST(test_strtrim__trim_right)
{ {
/* setup */ /* setup */
const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; char output[] = "\t\t \tDone is better than perfect.\t\t \n\n";
char *output = g_strdup(input);
/* test */ /* test */
g_strtrim(output, 2); g_strtrim(output, 2);
@ -356,8 +354,7 @@ END_TEST
START_TEST(test_strtrim__trim_both) START_TEST(test_strtrim__trim_both)
{ {
/* setup */ /* setup */
const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; char output[] = "\t\t \tDone is better than perfect.\t\t \n\n";
char *output = g_strdup(input);
/* test */ /* test */
g_strtrim(output, 3); g_strtrim(output, 3);
@ -370,8 +367,7 @@ END_TEST
START_TEST(test_strtrim__trim_through) START_TEST(test_strtrim__trim_through)
{ {
/* setup */ /* setup */
const char *input = "\t\t \tDone is better than perfect.\t\t \n\n"; char output[] = "\t\t \tDone is better than perfect.\t\t \n\n";
char *output = g_strdup(input);
/* test */ /* test */
g_strtrim(output, 4); g_strtrim(output, 4);