Skip to content

Commit 5b32025

Browse files
committed
rewrite TestCleanUploadFileName to avoid nolint
1 parent d10e0d3 commit 5b32025

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

services/repository/files/file_test.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ import (
1010
)
1111

1212
func TestCleanUploadFileName(t *testing.T) {
13-
assert.Equal(t, "", CleanGitTreePath("")) //nolint:testifylint // for readability and alignment
14-
assert.Equal(t, "", CleanGitTreePath(".")) //nolint:testifylint // for readability and alignment
15-
assert.Equal(t, "a/b", CleanGitTreePath("a/b"))
16-
assert.Equal(t, "", CleanGitTreePath(".git/b")) //nolint:testifylint // for readability and alignment
17-
assert.Equal(t, "", CleanGitTreePath("a/.git")) //nolint:testifylint // for readability and alignment
13+
cases := []struct {
14+
input, expected string
15+
}{
16+
{"", ""},
17+
{".", ""},
18+
{"a/./b", "a/b"},
19+
{"a.git", "a.git"},
20+
{".git/b", ""},
21+
{"a/.git", ""},
22+
{"/a/../../b", "b"},
23+
}
24+
for _, c := range cases {
25+
assert.Equal(t, c.expected, CleanGitTreePath(c.input), "input: %q", c.input)
26+
}
1827
}

0 commit comments

Comments
 (0)