mirror of https://github.com/markbates/pkger.git
for you both
This commit is contained in:
parent
e8a8d77764
commit
cad42281de
|
@ -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())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue