photoprism/pkg/fs/name_test.go
Michael Mayer fe28c7d284 Backend: Add support for .ppignore files #233 #287
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-05-03 14:40:59 +02:00

20 lines
534 B
Go

package fs
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRelativeName(t *testing.T) {
t.Run("/some/path", func(t *testing.T) {
assert.Equal(t, "foo/bar.baz", RelativeName("/some/path/foo/bar.baz", "/some/path"))
})
t.Run("/some/path/", func(t *testing.T) {
assert.Equal(t, "foo/bar.baz", RelativeName("/some/path/foo/bar.baz", "/some/path/"))
})
t.Run("/some/path/bar", func(t *testing.T) {
assert.Equal(t, "/some/path/foo/bar.baz", RelativeName("/some/path/foo/bar.baz", "/some/path/bar"))
})
}