2019-11-19 00:07:12 -08:00
|
|
|
package cache
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"os"
|
2019-12-25 13:57:07 +02:00
|
|
|
"path/filepath"
|
2019-11-19 00:07:12 -08:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
2019-12-16 08:44:43 +02:00
|
|
|
func TestRealCache_Clear(t *testing.T) {
|
|
|
|
|
d, _ := ioutil.TempDir("", "TestRealCache_Clear")
|
2019-12-25 13:57:07 +02:00
|
|
|
defer os.RemoveAll(d)
|
|
|
|
|
c, err := New(d)
|
|
|
|
|
assert.NoError(t, err)
|
2019-11-18 22:03:04 -08:00
|
|
|
assert.NoError(t, c.Clear())
|
2019-12-25 13:57:07 +02:00
|
|
|
_, err = os.Stat(filepath.Join(d, "fanal"))
|
2019-11-19 00:07:12 -08:00
|
|
|
assert.True(t, os.IsNotExist(err))
|
|
|
|
|
}
|