for you both

This commit is contained in:
Mark Bates 2019-09-21 17:11:07 -04:00
parent e8a8d77764
commit cad42281de
1 changed files with 36 additions and 1 deletions

View File

@ -8,7 +8,6 @@ import (
)
func Test_NewFileInfo(t *testing.T) {
const exp = "/public/images/mark.png"
in := []string{
"/public/images/mark.png",
@ -22,6 +21,7 @@ func Test_NewFileInfo(t *testing.T) {
"\\public\\images\\mark.png",
}
const exp = "/public/images/mark.png"
for _, n := range in {
t.Run(n, func(st *testing.T) {
r := require.New(st)
@ -45,3 +45,38 @@ func Test_NewFileInfo(t *testing.T) {
}
}
func Test_WithName(t *testing.T) {
f1 := &FileInfo{
Details: Details{
Name: "/walls/crumbling",
Size: 42,
Mode: os.FileMode(0644),
IsDir: true,
},
}
const exp = "/public/images/mark.png"
in := []string{
"/public/images/mark.png",
"public/images/mark.png",
"/public\\images/mark.png",
"public/images\\mark.png",
"\\public\\images\\mark.png",
"public\\images\\mark.png",
"\\public/images\\mark.png",
"public\\images/mark.png",
"\\public\\images\\mark.png",
}
for _, n := range in {
t.Run(n, func(st *testing.T) {
r := require.New(st)
f2 := WithName(n, f1)
r.Equal(exp, f2.Name())
})
}
}