2014-08-22 15:31:03 +08:00
|
|
|
package dirwatch
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"testing"
|
2018-01-06 13:53:40 +08:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
2014-08-22 15:31:03 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestDirwatch(t *testing.T) {
|
|
|
|
tempDirName, err := ioutil.TempDir("", "")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
defer os.RemoveAll(tempDirName)
|
2014-12-04 02:10:29 +08:00
|
|
|
t.Logf("tempdir: %q", tempDirName)
|
2014-08-22 15:31:03 +08:00
|
|
|
dw, err := New(tempDirName)
|
2018-01-06 13:53:40 +08:00
|
|
|
require.NoError(t, err)
|
2014-12-04 02:10:29 +08:00
|
|
|
defer dw.Close()
|
2014-08-22 15:31:03 +08:00
|
|
|
}
|