pkger/pkging/pkgtest/remove.go

25 lines
384 B
Go
Raw Permalink Normal View History

2019-11-01 23:08:10 +03:00
package pkgtest
2019-10-31 00:32:47 +03:00
import (
"testing"
"github.com/markbates/pkger/pkging"
"github.com/stretchr/testify/require"
)
func RemoveTest(t *testing.T, ref *Ref, pkg pkging.Pkger) {
r := require.New(t)
name := "/go.mod"
2019-11-01 22:53:54 +03:00
_, err := LoadFile(name, ref, pkg)
2019-11-01 00:20:15 +03:00
r.NoError(err)
2019-10-31 00:32:47 +03:00
2019-11-01 00:20:15 +03:00
_, err = pkg.Stat(name)
2019-10-31 00:32:47 +03:00
r.NoError(err)
r.NoError(pkg.Remove(name))
_, err = pkg.Stat(name)
r.Error(err)
}