diff options
Diffstat (limited to 'cmd/lftpq/main_test.go')
-rw-r--r-- | cmd/lftpq/main_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cmd/lftpq/main_test.go b/cmd/lftpq/main_test.go index f1287cd..b2de28e 100644 --- a/cmd/lftpq/main_test.go +++ b/cmd/lftpq/main_test.go @@ -408,3 +408,27 @@ func TestRunListError(t *testing.T) { t.Errorf("want %q, got %q", want, got) } } + +func TestClassify(t *testing.T) { + cli, buf := newTestCLI(` +{ + "LocalDirs": [ + { + "Name": "d1", + "Parser": "movie", + "Dir": "/media/{{ .Year}}/" + } + ] +}`) + defer os.Remove(cli.Config) + + cli.Name = "/download/foo.2018" + if err := cli.Run(); err != nil { + t.Fatal(err) + } + + want := "/media/2018/foo.2018\n" + if got := buf.String(); got != want { + t.Errorf("want %q, got %q", want, got) + } +} |