TestRandomUnixTmpDirPath platform agnostic

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2015-09-24 09:37:07 -07:00
parent f09705e6aa
commit b5e2a90aa3
2 changed files with 15 additions and 6 deletions

View file

@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path"
"runtime"
"strings"
"testing"
"time"
@ -341,10 +342,13 @@ func TestListTar(t *testing.T) {
}
}
func TestRandomUnixTmpDirPath(t *testing.T) {
path := RandomUnixTmpDirPath("something")
func TestRandomTmpDirPath(t *testing.T) {
path := RandomTmpDirPath("something")
prefix := "/tmp/something"
if runtime.GOOS == "windows" {
prefix = os.Getenv("TEMP") + `\something`
}
expectedSize := len(prefix) + 11
if !strings.HasPrefix(path, prefix) {