gf/debug/gdebug/gdebug_testdata.go
2021-01-17 21:46:25 +08:00

24 lines
786 B
Go

// Copyright GoFrame Author(https://goframe.org). 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"
)
// TestDataPath retrieves and returns the testdata path of current package,
// which is used for unit testing cases only.
// The optional parameter <names> specifies the its sub-folders/sub-files,
// which will be joined with current system separator and returned with the path.
func TestDataPath(names ...string) string {
path := CallerDirectory() + string(filepath.Separator) + "testdata"
for _, name := range names {
path += string(filepath.Separator) + name
}
return path
}