fs is dir entry
This commit is contained in:
parent
e576e62599
commit
fd3beea874
12 changed files with 172 additions and 27 deletions
src/host/vfs
|
@ -41,6 +41,7 @@ func (d *Dummy) ReadAt(p []byte, off int64) (n int, err error) {
|
|||
var _ File = &Dummy{}
|
||||
|
||||
type DummyFs struct {
|
||||
name string
|
||||
}
|
||||
|
||||
// Stat implements Filesystem.
|
||||
|
@ -67,6 +68,26 @@ func (d *DummyFs) ReadDir(path string) ([]fs.DirEntry, error) {
|
|||
return nil, os.ErrNotExist
|
||||
}
|
||||
|
||||
// Info implements Filesystem.
|
||||
func (d *DummyFs) Info() (fs.FileInfo, error) {
|
||||
return newDirInfo(d.name), nil
|
||||
}
|
||||
|
||||
// IsDir implements Filesystem.
|
||||
func (d *DummyFs) IsDir() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Name implements Filesystem.
|
||||
func (d *DummyFs) Name() string {
|
||||
return d.name
|
||||
}
|
||||
|
||||
// Type implements Filesystem.
|
||||
func (d *DummyFs) Type() fs.FileMode {
|
||||
return fs.ModeDir
|
||||
}
|
||||
|
||||
var _ Filesystem = &DummyFs{}
|
||||
|
||||
func TestResolver(t *testing.T) {
|
||||
|
@ -174,7 +195,7 @@ func TestFiles(t *testing.T) {
|
|||
{
|
||||
file, err := getFile(files, "/test")
|
||||
require.NoError(err)
|
||||
require.Equal(&dir{}, file)
|
||||
require.Equal(&dir{name: "test"}, file)
|
||||
}
|
||||
{
|
||||
file, err := getFile(files, "/test/file.txt")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue