Skip to content

Commit a3cbd20

Browse files
committed
test: improve badname verification test
The name of the `write_invalid_filename` function suggests that we _want_ to write an invalid filename. Rename the function to show that we expect to _fail_ to write the invalid filename.
1 parent b846434 commit a3cbd20

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/index/tests.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ static void replace_char(char *str, char in, char out)
599599
*c = out;
600600
}
601601

602-
static void write_invalid_filename(git_repository *repo, const char *fn_orig)
602+
static void assert_write_fails(git_repository *repo, const char *fn_orig)
603603
{
604604
git_index *index;
605605
git_oid expected;
@@ -672,13 +672,13 @@ void test_index_tests__write_invalid_filename(void)
672672

673673
cl_git_pass(git_repository_init(&repo, "./invalid", 0));
674674

675-
write_invalid_filename(repo, ".git/hello");
676-
write_invalid_filename(repo, ".GIT/hello");
677-
write_invalid_filename(repo, ".GiT/hello");
678-
write_invalid_filename(repo, "./.git/hello");
679-
write_invalid_filename(repo, "./foo");
680-
write_invalid_filename(repo, "./bar");
681-
write_invalid_filename(repo, "foo/../bar");
675+
assert_write_fails(repo, ".git/hello");
676+
assert_write_fails(repo, ".GIT/hello");
677+
assert_write_fails(repo, ".GiT/hello");
678+
assert_write_fails(repo, "./.git/hello");
679+
assert_write_fails(repo, "./foo");
680+
assert_write_fails(repo, "./bar");
681+
assert_write_fails(repo, "foo/../bar");
682682

683683
git_repository_free(repo);
684684

@@ -696,10 +696,10 @@ void test_index_tests__honors_protect_filesystems(void)
696696
cl_repo_set_bool(repo, "core.protectHFS", true);
697697
cl_repo_set_bool(repo, "core.protectNTFS", true);
698698

699-
write_invalid_filename(repo, ".git./hello");
700-
write_invalid_filename(repo, ".git\xe2\x80\xad/hello");
701-
write_invalid_filename(repo, "git~1/hello");
702-
write_invalid_filename(repo, ".git\xe2\x81\xaf/hello");
699+
assert_write_fails(repo, ".git./hello");
700+
assert_write_fails(repo, ".git\xe2\x80\xad/hello");
701+
assert_write_fails(repo, "git~1/hello");
702+
assert_write_fails(repo, ".git\xe2\x81\xaf/hello");
703703

704704
git_repository_free(repo);
705705

0 commit comments

Comments
 (0)