23 lines
683 B
Go
23 lines
683 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestLibraryPerFolder(t *testing.T) {
|
|
cfg := &DirectConfig{Library: "kb"}
|
|
cases := map[string]string{
|
|
"/Users/x/Desktop/finance": "finance",
|
|
"/Users/x/Desktop/HR Docs": "hr_docs",
|
|
"/Users/x/Desktop/官方總圖": "kb",
|
|
"/Users/x/Desktop/test 01": "test_01",
|
|
}
|
|
for in, want := range cases {
|
|
if got := cfg.libraryFor(in); got != want {
|
|
t.Errorf("libraryFor(%q) = %q, want %q", in, got, want)
|
|
}
|
|
}
|
|
cfg.Libraries = map[string]string{"/Users/x/Desktop/官方總圖": "official"}
|
|
if got := cfg.libraryFor("/Users/x/Desktop/官方總圖"); got != "official" {
|
|
t.Errorf("明列對映應優先,got %q", got)
|
|
}
|
|
}
|