unit_test_helper_test.go 935 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. }
  11. tests := []struct {
  12. name string
  13. args args
  14. want string
  15. }{
  16. {
  17. name: "loghelper", args: args{
  18. resourceFolderNames: []string{"log_helper"},
  19. goBackTimes: 1,
  20. },
  21. want: filepath.FromSlash("../ChineseSubFinder-TestData/log_helper"),
  22. },
  23. {
  24. name: "language", args: args{
  25. resourceFolderNames: []string{"language", "test"},
  26. goBackTimes: 1,
  27. },
  28. want: filepath.FromSlash("../ChineseSubFinder-TestData/language/test"),
  29. },
  30. }
  31. for _, tt := range tests {
  32. t.Run(tt.name, func(t *testing.T) {
  33. if got := GetTestDataResourceRootPath(tt.args.resourceFolderNames, tt.args.goBackTimes); got != tt.want {
  34. t.Errorf("GetTestDataResourceRootPath() = %v, want %v", got, tt.want)
  35. }
  36. })
  37. }
  38. }