Skip to content

Commit efa8786

Browse files
Chandra Pratapgitster
authored andcommitted
t: improve the test-case for parse_names()
In the existing test-case for parse_names(), the fact that empty lines should be ignored is not obvious because the empty line is immediately followed by end-of-string. This can be mistaken as the empty line getting replaced by NULL. Improve this by adding a non-empty line after the empty one to demonstrate the intended behavior. Mentored-by: Patrick Steinhardt <[email protected]> Mentored-by: Christian Couder <[email protected]> Signed-off-by: Chandra Pratap <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e31efff commit efa8786

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/unit-tests/t-reftable-basics.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ static void test_parse_names_normal(void)
8989

9090
static void test_parse_names_drop_empty(void)
9191
{
92-
char in[] = "a\n\n";
92+
char in[] = "a\n\nb\n";
9393
char **out = NULL;
9494
parse_names(in, strlen(in), &out);
9595
check_str(out[0], "a");
96-
check(!out[1]);
96+
/* simply '\n' should be dropped as empty string */
97+
check_str(out[1], "b");
98+
check(!out[2]);
9799
free_names(out);
98100
}
99101

0 commit comments

Comments
 (0)