mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
refactor: hrp convert
This commit is contained in:
@@ -285,7 +285,8 @@ func LoadFile(path string, structObj interface{}) (err error) {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "read file failed")
|
||||
}
|
||||
|
||||
// remove BOM at the beginning of file
|
||||
file = bytes.Trim(file, "\xef\xbb\xbf")
|
||||
ext := filepath.Ext(path)
|
||||
switch ext {
|
||||
case ".json", ".har":
|
||||
@@ -351,3 +352,9 @@ func readFile(path string) ([]byte, error) {
|
||||
}
|
||||
return file, nil
|
||||
}
|
||||
|
||||
func GetOutputNameWithoutExtension(path string) string {
|
||||
base := filepath.Base(path)
|
||||
ext := filepath.Ext(base)
|
||||
return base[0:len(base)-len(ext)] + "_test"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user