test: sanitize temp dir names since subtest names have slashes

This commit is contained in:
Frank Schroeder 2017-05-19 10:48:28 +02:00
parent 2a39c480b9
commit eded493206
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
1 changed files with 2 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
)
@ -35,6 +36,7 @@ func TempDir(t *testing.T, name string) string {
if t != nil && t.Name() != "" {
name = t.Name() + "-" + name
}
name = strings.Replace(name, "/", "_", -1)
d, err := ioutil.TempDir(tmpdir, name)
if err != nil {
t.Fatalf("err: %s", err)