You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bit4sat/utils/paths_test.go

36 lines
569 B
Go

package utils
import "testing"
type CleanName struct {
name string
ext string
}
func TestCleanFileName(t *testing.T) {
tests := map[string]CleanName{
"noext": CleanName{"noext", ""},
"with.ext": CleanName{"with", ".ext"},
"path/with.ext": CleanName{"with", ".ext"},
"path/noext": CleanName{"noext", ""},
}
for name, expected := range tests {
t.Run(name, func(t *testing.T) {
resName, resExt := CleanFileName(name)
if resName != expected.name {
t.Fail()
}
if resExt != expected.ext {
t.Fail()
}
})
}
}