add verification on nil log
Signed-off-by: Benjamin Wang <wachao@vmware.com>
This commit is contained in:
@ -26,6 +26,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
||||
@ -218,3 +219,14 @@ func TestRemoveMatchFile(t *testing.T) {
|
||||
t.Errorf("expected error, got nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTouchDirAll(t *testing.T) {
|
||||
tmpdir := t.TempDir()
|
||||
assert.Panics(t, func() {
|
||||
TouchDirAll(nil, tmpdir)
|
||||
}, "expected panic with nil log")
|
||||
|
||||
if err := TouchDirAll(zaptest.NewLogger(t), tmpdir); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user