added test for file name normalization with leading dot
This commit is contained in:
@@ -215,6 +215,7 @@ func TestFileNameNormalizations(t *testing.T) {
|
||||
{"a.b.c.?.?.?.2", `^a_b_c_\w{10}\.2$`},
|
||||
{"a.b.c.d.tar.gz", `^a_b_c_d_\w{10}\.tar\.gz$`},
|
||||
{"abcd", `^abcd_\w{10}\.txt$`},
|
||||
{".abcd.123.", `^abcd_\w{10}\.123$`},
|
||||
{"a b! c d . 456", `^a_b_c_d_\w{10}\.456$`}, // normalize spaces
|
||||
{strings.Repeat("a", 101) + "." + strings.Repeat("b", 21), `^a{100}_\w{10}\.b{20}$`}, // name and extension length trim
|
||||
}
|
||||
@@ -225,7 +226,8 @@ func TestFileNameNormalizations(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if match, err := regexp.Match(s.pattern, []byte(f.Name)); !match {
|
||||
match, err := regexp.Match(s.pattern, []byte(f.Name))
|
||||
if !match {
|
||||
t.Fatalf("Expected Name to match %v, got %q (%v)", s.pattern, f.Name, err)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user