3bc100aeb3
This adds support for gitignore-like wildcards and exclude patters in reverse mode. It (somewhat) fixes #273: no regexp support, but the syntax should be powerful enough to satisfy most needs. Also, since adding a lot of --exclude options can be tedious, it adds the --exclude-from option to read patterns from a file (or files).
31 lines
791 B
Go
31 lines
791 B
Go
package nametransform
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestIsLongName(t *testing.T) {
|
|
n := "gocryptfs.longname.LkwUdALvV_ANnzQN6ZZMYnxxfARD3IeZWCKnxGJjYmU=.name"
|
|
if NameType(n) != LongNameFilename {
|
|
t.Errorf("False negative")
|
|
}
|
|
|
|
n = "gocryptfs.longname.LkwUdALvV_ANnzQN6ZZMYnxxfARD3IeZWCKnxGJjYmU="
|
|
if NameType(n) != LongNameContent {
|
|
t.Errorf("False negative")
|
|
}
|
|
|
|
n = "LkwUdALvV_ANnzQN6ZZMYnxxfARD3IeZWCKnxGJjYmU="
|
|
if NameType(n) != LongNameNone {
|
|
t.Errorf("False positive")
|
|
}
|
|
}
|
|
|
|
func TestRemoveLongNameSuffix(t *testing.T) {
|
|
filename := "gocryptfs.longname.LkwUdALvV_ANnzQN6ZZMYnxxfARD3IeZWCKnxGJjYmU=.name"
|
|
content := "gocryptfs.longname.LkwUdALvV_ANnzQN6ZZMYnxxfARD3IeZWCKnxGJjYmU="
|
|
if RemoveLongNameSuffix(filename) != content {
|
|
t.Error(".name suffix not removed")
|
|
}
|
|
}
|