tests clear

This commit is contained in:
bel
2025-04-04 23:09:29 -06:00
parent dc8c9fdf0c
commit caef12deb8
2 changed files with 45 additions and 0 deletions

View File

@@ -11,6 +11,48 @@ import (
main "gitea/show-ingestion"
)
func TestRunChoosesOne(t *testing.T) {
ind := t.TempDir()
outd := t.TempDir()
for _, given := range []string{
"Survivor.AU.S12E11.1080p.HEVC.x265-MeGusta[EZTVx.to].mkv",
"Survivor.AU.S12E11.720p.HEVC.x265-MeGusta[EZTVx.to].mkv",
"Survivor.AU.S12E12.720p.HEVC.x265-MeGusta[EZTVx.to].mkv",
} {
ioutil.WriteFile(path.Join(ind, given), []byte{}, os.ModePerm)
}
want := map[string]bool{
"Australian_Survivor_S12E11.mkv": false,
"Australian_Survivor_S12E12.mkv": false,
}
if err := main.Run(context.Background(),
outd,
ind,
[]string{
".urvivor.[Aa][Uu].*[sS](?P<season>[0-9]+)[eE](?P<episode>[0-9]*).*1080.*MeGusta",
".urvivor.[Aa][Uu].*[sS](?P<season>[0-9]+)[eE](?P<episode>[0-9]*).*720.*MeGusta",
},
main.Fields{
Title: "Australian_Survivor",
},
func(outf, inf string) error {
want[path.Base(outf)] = true
return nil
},
); err != nil {
t.Fatal(err)
}
for k, v := range want {
if !v {
t.Errorf("did not mv_n_ln(outf=%s)", k)
}
}
}
func TestRun(t *testing.T) {
cases := map[string]struct {
given []string