32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/andreyvit/diff"
|
|
)
|
|
|
|
func Test(t *testing.T) {
|
|
m := newMediaElement("Misfits - S02E03 - EN FORCED")
|
|
result := "Misfits - S02E03 EN FORCED"
|
|
if m.Path() != result {
|
|
t.Error("Expected " + result + ", got " + m.Path())
|
|
}
|
|
}
|
|
|
|
func TestExamples(t *testing.T) {
|
|
// list of strings with expected output
|
|
examples := [][]string{
|
|
{"Speak.No.Evil.2024.German.EAC3.DL.1080p.BluRay.x265-VECTOR.nfo", "Speak No Evil (2024) DE 1080p x265.nfo"},
|
|
{"Speak.No.Evil.2024.German.EAC3.DL.1080p.BluRay.x265-VECTOR/Speak.No.Evil.2024.nfo", "Speak No Evil (2024) DE 1080p x265.nfo"},
|
|
{"Speak.No.Evil.2024.nfo", "Speak No Evil (2024).nfo"},
|
|
{"Miracles.from.Heaven.2016.1080p.BluRay.X264-AMIABLE/Miracles.from.Heaven.2016.1080p.BluRay.X264-AMIABLE.mkv", "Miracles from Heaven (2016) 1080p x264.mkv"},
|
|
}
|
|
for _, example := range examples {
|
|
element := newMediaElement(example[0])
|
|
if expected, got := example[1], element.Path(); expected != got {
|
|
t.Errorf("Result not expected for %s:\n%v", example[0], diff.LineDiff(expected, got))
|
|
}
|
|
}
|
|
}
|