2020-03-16 22:47:39 +08:00
|
|
|
// Copyright 2019-2020 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
|
|
// If a copy of the MIT was not distributed with this file,
|
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
|
|
|
|
package gdebug
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
2020-03-21 19:41:05 +08:00
|
|
|
// TestDataPath retrieves and returns the testdata path of current package,
|
|
|
|
// which is used for unit testing cases only.
|
2020-03-28 00:37:23 +08:00
|
|
|
// The optional parameter <names> specifies the its sub-folders/sub-files,
|
2020-03-21 19:41:05 +08:00
|
|
|
// which will be joined with current system separator and returned with the path.
|
2020-03-21 19:31:58 +08:00
|
|
|
func TestDataPath(names ...string) string {
|
|
|
|
path := CallerDirectory() + string(filepath.Separator) + "testdata"
|
|
|
|
for _, name := range names {
|
|
|
|
path += string(filepath.Separator) + name
|
|
|
|
}
|
|
|
|
return path
|
2020-03-16 22:47:39 +08:00
|
|
|
}
|