remove panic and hopefully fix windows test

This commit is contained in:
Mark Bates 2019-08-09 16:54:19 -04:00
parent 8f38beeddf
commit 5e226a30e3
2 changed files with 6 additions and 1 deletions

1
dir.go
View File

@ -23,7 +23,6 @@ func MkdirAll(p string, perm os.FileMode) error {
Name: root, Name: root,
} }
if _, ok := filesCache.Load(pt); ok { if _, ok := filesCache.Load(pt); ok {
panic(pt)
root = filepath.Dir(root) root = filepath.Dir(root)
continue continue
} }

View File

@ -6,6 +6,7 @@ import (
"io/ioutil" "io/ioutil"
"strings" "strings"
"testing" "testing"
"time"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -70,6 +71,11 @@ func Test_File_Write(t *testing.T) {
r.NoError(err) r.NoError(err)
r.Equal(int64(1381), sz) r.Equal(int64(1381), sz)
// because windows can't handle the time precisely
// enough, we have to *force* just a smidge of time
// to ensure the two ModTime's are different.
// i know, i hate it too.
time.Sleep(time.Millisecond)
r.NoError(f.Close()) r.NoError(f.Close())
r.Equal(int64(1381), fi.Size()) r.Equal(int64(1381), fi.Size())
r.NotZero(fi.ModTime()) r.NotZero(fi.ModTime())