royalcat
991c15fdef
Some checks failed
docker / build-docker (linux/amd64) (push) Successful in 1m33s
docker / build-docker (linux/386) (push) Successful in 1m39s
docker / build-docker (linux/arm64) (push) Successful in 7m6s
docker / build-docker (linux/arm/v7) (push) Successful in 7m31s
docker / build-docker (linux/arm64/v8) (push) Has been cancelled
43 lines
859 B
Go
43 lines
859 B
Go
package vfs
|
|
|
|
import (
|
|
"io/fs"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestFileinfo(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
require := require.New(t)
|
|
|
|
fi := NewFileInfo("abc/name", 42)
|
|
|
|
require.Equal("name", fi.Name())
|
|
require.False(fi.IsDir())
|
|
require.Equal(int64(42), fi.Size())
|
|
require.NotNil(fi.ModTime())
|
|
require.Zero(fi.Type() & fs.ModeDir)
|
|
require.Zero(fi.Mode() & fs.ModeDir)
|
|
require.Equal(fs.FileMode(0555), fi.Mode())
|
|
require.Nil(fi.Sys())
|
|
}
|
|
|
|
func TestDirInfo(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
require := require.New(t)
|
|
|
|
fi := newDirInfo("abc/name")
|
|
|
|
require.True(fi.IsDir())
|
|
require.Equal("name", fi.Name())
|
|
require.Equal(int64(0), fi.Size())
|
|
require.NotNil(fi.ModTime())
|
|
require.NotZero(fi.Type() & fs.ModeDir)
|
|
require.NotZero(fi.Mode() & fs.ModeDir)
|
|
require.Equal(ROMode|fs.ModeDir, fi.Mode())
|
|
require.Nil(fi.Sys())
|
|
|
|
}
|