old_test.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package old
  2. import "testing"
  3. func TestIsOldVersionSubPrefixName(t *testing.T) {
  4. type args struct {
  5. subFileName string
  6. }
  7. tests := []struct {
  8. name string
  9. args args
  10. want bool
  11. want1 string
  12. want2 string
  13. }{
  14. {name: "chs_en", args: args{subFileName: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.chs_en.ass"}, want: true, want1: ".chs_en.ass", want2: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.chinese(简英).default.ass"},
  15. {name: "chs[subhd]", args: args{subFileName: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.chs[subhd].ass"}, want: true, want1: ".chs[subhd].ass", want2: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.chinese(简,subhd).ass"},
  16. {name: "chs_en[shooter]", args: args{subFileName: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.chs_en[shooter].ass"}, want: true, want1: ".chs_en[shooter].ass", want2: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.chinese(简英,shooter).ass"},
  17. {name: "cht_en[xunlei]", args: args{subFileName: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.cht_en[xunlei].ass"}, want: true, want1: ".cht_en[xunlei].ass", want2: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.chinese(繁英,xunlei).ass"},
  18. {name: "zh", args: args{subFileName: "Loki - S01E01 - Glorious Purpose WEBDL-1080p Proper.zh.ass"}, want: false, want1: "", want2: ""},
  19. }
  20. for _, tt := range tests {
  21. t.Run(tt.name, func(t *testing.T) {
  22. got, got1, got2 := IsOldVersionSubPrefixName(tt.args.subFileName)
  23. if got != tt.want {
  24. t.Errorf("IsOldVersionSubPrefixName() got = %v, want %v", got, tt.want)
  25. }
  26. if got1 != tt.want1 {
  27. t.Errorf("IsOldVersionSubPrefixName() got1 = %v, want %v", got1, tt.want1)
  28. }
  29. if got2 != tt.want2 {
  30. t.Errorf("IsOldVersionSubPrefixName() got2 = %v, want %v", got2, tt.want2)
  31. }
  32. })
  33. }
  34. }