mirror of
https://github.com/ordinary-dev/phoenix
synced 2024-09-20 03:40:29 +05:00
16 lines
295 B
Go
16 lines
295 B
Go
package testutils
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
"runtime"
|
|
)
|
|
|
|
// Change the current directory to the project directory.
|
|
// Useful for tests that work with files.
|
|
func ResetWorkingDir() error {
|
|
_, filename, _, _ := runtime.Caller(0)
|
|
dir := path.Join(path.Dir(filename), "..")
|
|
return os.Chdir(dir)
|
|
}
|