unit_test_helper_test.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package unit_test_helper
  2. import (
  3. "path/filepath"
  4. "testing"
  5. )
  6. func TestGetTestDataResourceRootPath(t *testing.T) {
  7. type args struct {
  8. resourceFolderNames []string
  9. goBackTimes int
  10. useCopyData bool
  11. }
  12. tests := []struct {
  13. name string
  14. args args
  15. want string
  16. }{
  17. {
  18. name: "loghelper", args: args{
  19. resourceFolderNames: []string{"log_helper"},
  20. goBackTimes: 1,
  21. useCopyData: false,
  22. },
  23. want: filepath.FromSlash("../ChineseSubFinder-TestData/log_helper"),
  24. },
  25. {
  26. name: "language", args: args{
  27. resourceFolderNames: []string{"language", "test"},
  28. goBackTimes: 1,
  29. useCopyData: false,
  30. },
  31. want: filepath.FromSlash("../ChineseSubFinder-TestData/language/test"),
  32. },
  33. }
  34. for _, tt := range tests {
  35. t.Run(tt.name, func(t *testing.T) {
  36. if got := GetTestDataResourceRootPath(tt.args.resourceFolderNames, tt.args.goBackTimes, tt.args.useCopyData); got != tt.want {
  37. t.Errorf("GetTestDataResourceRootPath() = %v, want %v", got, tt.want)
  38. }
  39. })
  40. }
  41. }