unit_test_helper.go 645 B

1234567891011121314151617181920212223242526
  1. package unit_test_helper
  2. import (
  3. "path/filepath"
  4. )
  5. // GetTestDataResourceRootPath 向上返回几层就能够到 ChineseSubFinder-TestData 同级目录,然后进入其中的 resourceFolderName 资源文件夹中
  6. func GetTestDataResourceRootPath(resourceFolderNames []string, goBackTimes int) string {
  7. times := ""
  8. for i := 0; i < goBackTimes; i++ {
  9. times += oneBackTime
  10. }
  11. outPath := times + testResourceProjectName
  12. for _, name := range resourceFolderNames {
  13. outPath += "/" + name
  14. }
  15. outPath = filepath.FromSlash(outPath)
  16. return outPath
  17. }
  18. const oneBackTime = "../"
  19. const testResourceProjectName = "ChineseSubFinder-TestData"