forked from mirror/pkger
three marlenas
This commit is contained in:
parent
7779fbd3a9
commit
85055a4cb7
2
fs/fs.go
2
fs/fs.go
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/markbates/pkger/here"
|
||||
)
|
||||
|
||||
type FileSystem interface {
|
||||
type Warehouse interface {
|
||||
Parse(p string) (Path, error)
|
||||
Abs(string) (string, error)
|
||||
AbsPath(Path) (string, error)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"github.com/markbates/pkger/fs"
|
||||
)
|
||||
|
||||
func Files(fx fs.FileSystem) (TestFiles, error) {
|
||||
func Files(fx fs.Warehouse) (TestFiles, error) {
|
||||
tf := TestFiles{}
|
||||
for _, f := range fileList {
|
||||
pt, err := fx.Parse(f)
|
||||
|
|
|
@ -18,12 +18,12 @@ const hart = "/easy/listening/grant.hart"
|
|||
const husker = "github.com/husker/du"
|
||||
|
||||
type Suite struct {
|
||||
fs.FileSystem
|
||||
fs.Warehouse
|
||||
}
|
||||
|
||||
func NewSuite(yourfs fs.FileSystem) (Suite, error) {
|
||||
func NewSuite(yourfs fs.Warehouse) (Suite, error) {
|
||||
suite := Suite{
|
||||
FileSystem: yourfs,
|
||||
Warehouse: yourfs,
|
||||
}
|
||||
return suite, nil
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ func (s Suite) Test(t *testing.T) {
|
|||
|
||||
func (s Suite) sub(t *testing.T, m reflect.Method) {
|
||||
name := strings.TrimPrefix(m.Name, "Test_")
|
||||
name = fmt.Sprintf("%T_%s", s.FileSystem, name)
|
||||
name = fmt.Sprintf("%T_%s", s.Warehouse, name)
|
||||
t.Run(name, func(st *testing.T) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
|
|
|
@ -15,10 +15,10 @@ type File struct {
|
|||
info *fs.FileInfo
|
||||
her here.Info
|
||||
path fs.Path
|
||||
fs fs.FileSystem
|
||||
fs fs.Warehouse
|
||||
}
|
||||
|
||||
func NewFile(fx fs.FileSystem, osf *os.File) (*File, error) {
|
||||
func NewFile(fx fs.Warehouse, osf *os.File) (*File, error) {
|
||||
|
||||
pt, err := fx.Parse(osf.Name())
|
||||
if err != nil {
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/markbates/pkger/internal/maps"
|
||||
)
|
||||
|
||||
var _ fs.FileSystem = &FS{}
|
||||
var _ fs.Warehouse = &FS{}
|
||||
|
||||
type FS struct {
|
||||
infos *maps.Infos
|
||||
|
|
|
@ -27,7 +27,7 @@ type File struct {
|
|||
parent fs.Path
|
||||
writer *bytes.Buffer
|
||||
reader io.Reader
|
||||
fs fs.FileSystem
|
||||
fs fs.Warehouse
|
||||
}
|
||||
|
||||
func (f *File) Seek(offset int64, whence int) (int64, error) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/markbates/pkger/internal/maps"
|
||||
)
|
||||
|
||||
var _ fs.FileSystem = &FS{}
|
||||
var _ fs.Warehouse = &FS{}
|
||||
|
||||
func WithInfo(fx *FS, infos ...here.Info) {
|
||||
for _, info := range infos {
|
||||
|
|
Loading…
Reference in New Issue