Skip to content

Commit 01dda5f

Browse files
committed
tests: unify ignore tests into their own dir
We had several occasions where tests for the gitignore had been added to status::ignore instead of the easier-to-handle attr::ignore test suite. This most likely resulted from the fact that the attr::ignore test suite is not easy to discover inside of the attr folder. Furthermore, ignore being part of the attributes code is an implementation detail, only, and thus shouldn't be stressed as much. Improve this by moving both attr::ignore and status::ignore tests into a new ignore test suite.
1 parent 65ad6b5 commit 01dda5f

File tree

2 files changed

+68
-68
lines changed

2 files changed

+68
-68
lines changed
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
static git_repository *g_repo = NULL;
77

8-
void test_attr_ignore__initialize(void)
8+
void test_ignore_path__initialize(void)
99
{
1010
g_repo = cl_git_sandbox_init("attr");
1111
}
1212

13-
void test_attr_ignore__cleanup(void)
13+
void test_ignore_path__cleanup(void)
1414
{
1515
cl_git_sandbox_cleanup();
1616
g_repo = NULL;
@@ -31,7 +31,7 @@ static void assert_is_ignored_(
3131
#define assert_is_ignored(expected, filepath) \
3232
assert_is_ignored_(expected, filepath, __FILE__, __LINE__)
3333

34-
void test_attr_ignore__honor_temporary_rules(void)
34+
void test_ignore_path__honor_temporary_rules(void)
3535
{
3636
cl_git_rewritefile("attr/.gitignore", "/NewFolder\n/NewFolder/NewFolder");
3737

@@ -41,7 +41,7 @@ void test_attr_ignore__honor_temporary_rules(void)
4141
assert_is_ignored(true, "NewFolder/NewFolder/File.txt");
4242
}
4343

44-
void test_attr_ignore__allow_root(void)
44+
void test_ignore_path__allow_root(void)
4545
{
4646
cl_git_rewritefile("attr/.gitignore", "/");
4747

@@ -51,7 +51,7 @@ void test_attr_ignore__allow_root(void)
5151
assert_is_ignored(false, "NewFolder/NewFolder/File.txt");
5252
}
5353

54-
void test_attr_ignore__ignore_space(void)
54+
void test_ignore_path__ignore_space(void)
5555
{
5656
cl_git_rewritefile("attr/.gitignore", "/\n\n/NewFolder \n/NewFolder/NewFolder");
5757

@@ -61,7 +61,7 @@ void test_attr_ignore__ignore_space(void)
6161
assert_is_ignored(true, "NewFolder/NewFolder/File.txt");
6262
}
6363

64-
void test_attr_ignore__intermittent_space(void)
64+
void test_ignore_path__intermittent_space(void)
6565
{
6666
cl_git_rewritefile("attr/.gitignore", "foo bar\n");
6767

@@ -70,7 +70,7 @@ void test_attr_ignore__intermittent_space(void)
7070
assert_is_ignored(true, "foo bar");
7171
}
7272

73-
void test_attr_ignore__trailing_space(void)
73+
void test_ignore_path__trailing_space(void)
7474
{
7575
cl_git_rewritefile(
7676
"attr/.gitignore",
@@ -85,7 +85,7 @@ void test_attr_ignore__trailing_space(void)
8585
assert_is_ignored(false, "bar ");
8686
}
8787

88-
void test_attr_ignore__escaped_trailing_spaces(void)
88+
void test_ignore_path__escaped_trailing_spaces(void)
8989
{
9090
cl_git_rewritefile(
9191
"attr/.gitignore",
@@ -107,23 +107,23 @@ void test_attr_ignore__escaped_trailing_spaces(void)
107107
assert_is_ignored(false, "qux ");
108108
}
109109

110-
void test_attr_ignore__ignore_dir(void)
110+
void test_ignore_path__ignore_dir(void)
111111
{
112112
cl_git_rewritefile("attr/.gitignore", "dir/\n");
113113

114114
assert_is_ignored(true, "dir");
115115
assert_is_ignored(true, "dir/file");
116116
}
117117

118-
void test_attr_ignore__ignore_dir_with_trailing_space(void)
118+
void test_ignore_path__ignore_dir_with_trailing_space(void)
119119
{
120120
cl_git_rewritefile("attr/.gitignore", "dir/ \n");
121121

122122
assert_is_ignored(true, "dir");
123123
assert_is_ignored(true, "dir/file");
124124
}
125125

126-
void test_attr_ignore__ignore_root(void)
126+
void test_ignore_path__ignore_root(void)
127127
{
128128
cl_git_rewritefile("attr/.gitignore", "/\n\n/NewFolder\n/NewFolder/NewFolder");
129129

@@ -133,7 +133,7 @@ void test_attr_ignore__ignore_root(void)
133133
assert_is_ignored(true, "NewFolder/NewFolder/File.txt");
134134
}
135135

136-
void test_attr_ignore__full_paths(void)
136+
void test_ignore_path__full_paths(void)
137137
{
138138
cl_git_rewritefile("attr/.gitignore", "Folder/*/Contained");
139139

@@ -153,7 +153,7 @@ void test_attr_ignore__full_paths(void)
153153
assert_is_ignored(false, "Folder/Middle/More/More/Contained/Not/Happy/Child");
154154
}
155155

156-
void test_attr_ignore__more_starstar_cases(void)
156+
void test_ignore_path__more_starstar_cases(void)
157157
{
158158
cl_must_pass(p_unlink("attr/.gitignore"));
159159
cl_git_mkfile(
@@ -171,7 +171,7 @@ void test_attr_ignore__more_starstar_cases(void)
171171
assert_is_ignored(false, "sub/sub2/aaa.html");
172172
}
173173

174-
void test_attr_ignore__leading_stars(void)
174+
void test_ignore_path__leading_stars(void)
175175
{
176176
cl_git_rewritefile(
177177
"attr/.gitignore",
@@ -204,7 +204,7 @@ void test_attr_ignore__leading_stars(void)
204204
assert_is_ignored(false, "dir1/kid2/file");
205205
}
206206

207-
void test_attr_ignore__globs_and_path_delimiters(void)
207+
void test_ignore_path__globs_and_path_delimiters(void)
208208
{
209209
cl_git_rewritefile("attr/.gitignore", "foo/bar/**");
210210
assert_is_ignored(true, "foo/bar/baz");
@@ -230,7 +230,7 @@ void test_attr_ignore__globs_and_path_delimiters(void)
230230
assert_is_ignored(false, "_test/foo/bar/code/file");
231231
}
232232

233-
void test_attr_ignore__skip_gitignore_directory(void)
233+
void test_ignore_path__skip_gitignore_directory(void)
234234
{
235235
cl_git_rewritefile("attr/.git/info/exclude", "/NewFolder\n/NewFolder/NewFolder");
236236
p_unlink("attr/.gitignore");
@@ -244,7 +244,7 @@ void test_attr_ignore__skip_gitignore_directory(void)
244244
assert_is_ignored(true, "NewFolder/NewFolder/File.txt");
245245
}
246246

247-
void test_attr_ignore__subdirectory_gitignore(void)
247+
void test_ignore_path__subdirectory_gitignore(void)
248248
{
249249
p_unlink("attr/.gitignore");
250250
cl_assert(!git_path_exists("attr/.gitignore"));
@@ -262,7 +262,7 @@ void test_attr_ignore__subdirectory_gitignore(void)
262262
assert_is_ignored(false, "dir/file3");
263263
}
264264

265-
void test_attr_ignore__expand_tilde_to_homedir(void)
265+
void test_ignore_path__expand_tilde_to_homedir(void)
266266
{
267267
git_config *cfg;
268268

@@ -292,7 +292,7 @@ void test_attr_ignore__expand_tilde_to_homedir(void)
292292

293293
/* Ensure that the .gitignore in the subdirectory only affects
294294
* items in the subdirectory. */
295-
void test_attr_ignore__gitignore_in_subdir(void)
295+
void test_ignore_path__gitignore_in_subdir(void)
296296
{
297297
cl_git_rmfile("attr/.gitignore");
298298

@@ -320,7 +320,7 @@ void test_attr_ignore__gitignore_in_subdir(void)
320320
}
321321

322322
/* Ensure that files do not match folder cases */
323-
void test_attr_ignore__dont_ignore_files_for_folder(void)
323+
void test_ignore_path__dont_ignore_files_for_folder(void)
324324
{
325325
cl_git_rmfile("attr/.gitignore");
326326

@@ -351,7 +351,7 @@ void test_attr_ignore__dont_ignore_files_for_folder(void)
351351
assert_is_ignored(false, "dir/TeSt");
352352
}
353353

354-
void test_attr_ignore__symlink_to_outside(void)
354+
void test_ignore_path__symlink_to_outside(void)
355355
{
356356
#ifdef GIT_WIN32
357357
cl_skip();
@@ -364,7 +364,7 @@ void test_attr_ignore__symlink_to_outside(void)
364364
assert_is_ignored(true, "lala/../symlink");
365365
}
366366

367-
void test_attr_ignore__test(void)
367+
void test_ignore_path__test(void)
368368
{
369369
cl_git_rewritefile("attr/.gitignore",
370370
"/*/\n"
@@ -376,7 +376,7 @@ void test_attr_ignore__test(void)
376376
assert_is_ignored(true, "bin/foo");
377377
}
378378

379-
void test_attr_ignore__unignore_dir_succeeds(void)
379+
void test_ignore_path__unignore_dir_succeeds(void)
380380
{
381381
cl_git_rewritefile("attr/.gitignore",
382382
"*.c\n"
@@ -385,7 +385,7 @@ void test_attr_ignore__unignore_dir_succeeds(void)
385385
assert_is_ignored(true, "src/foo/foo.c");
386386
}
387387

388-
void test_attr_ignore__case_insensitive_unignores_previous_rule(void)
388+
void test_ignore_path__case_insensitive_unignores_previous_rule(void)
389389
{
390390
git_config *cfg;
391391

@@ -402,7 +402,7 @@ void test_attr_ignore__case_insensitive_unignores_previous_rule(void)
402402
assert_is_ignored(false, "case/file");
403403
}
404404

405-
void test_attr_ignore__case_sensitive_unignore_does_nothing(void)
405+
void test_ignore_path__case_sensitive_unignore_does_nothing(void)
406406
{
407407
git_config *cfg;
408408

@@ -419,7 +419,7 @@ void test_attr_ignore__case_sensitive_unignore_does_nothing(void)
419419
assert_is_ignored(true, "case/file");
420420
}
421421

422-
void test_attr_ignore__ignored_subdirfiles_with_subdir_rule(void)
422+
void test_ignore_path__ignored_subdirfiles_with_subdir_rule(void)
423423
{
424424
cl_git_rewritefile(
425425
"attr/.gitignore",
@@ -431,7 +431,7 @@ void test_attr_ignore__ignored_subdirfiles_with_subdir_rule(void)
431431
assert_is_ignored(true, "dir/sub1/sub2");
432432
}
433433

434-
void test_attr_ignore__ignored_subdirfiles_with_negations(void)
434+
void test_ignore_path__ignored_subdirfiles_with_negations(void)
435435
{
436436
cl_git_rewritefile(
437437
"attr/.gitignore",
@@ -443,7 +443,7 @@ void test_attr_ignore__ignored_subdirfiles_with_negations(void)
443443
assert_is_ignored(true, "dir/sub1/c.test");
444444
}
445445

446-
void test_attr_ignore__negative_directory_rules_only_match_directories(void)
446+
void test_ignore_path__negative_directory_rules_only_match_directories(void)
447447
{
448448
cl_git_rewritefile(
449449
"attr/.gitignore",

0 commit comments

Comments
 (0)