mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-08 11:58:34 +00:00
16 lines
325 B
Go
16 lines
325 B
Go
package testing
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
// TempDir creates a temporary directory and returns its path along
|
|
// with a cleanup function to be called via defer.
|
|
func TempDir(t *testing.T) (string, func()) {
|
|
tmpDir, err := ioutil.TempDir("", "")
|
|
Ok(t, err)
|
|
return tmpDir, func() { os.RemoveAll(tmpDir) }
|
|
}
|