Documentation
¶
Overview ¶
Package aferoassert provides assertions for spf13/afero
Index ¶
- Variables
- func DirExists(t TestingT, fs afero.Fs, path string, msgAndArgs ...interface{}) bool
- func Exists(t TestingT, fs afero.Fs, path string, msgAndArgs ...interface{}) bool
- func FileContent(t TestingT, fs afero.Fs, path string, expected string, ...) bool
- func FileContentRegexp(t TestingT, fs afero.Fs, path string, expected interface{}, ...) bool
- func FileExists(t TestingT, fs afero.Fs, path string, msgAndArgs ...interface{}) bool
- func FileModeFromUint64(mode uint64) *os.FileMode
- func FileModePtr(mode os.FileMode) *os.FileMode
- func NoDirExists(t TestingT, fs afero.Fs, path string, msgAndArgs ...interface{}) bool
- func NoExists(t TestingT, fs afero.Fs, path string, msgAndArgs ...interface{}) bool
- func NoFileExists(t TestingT, fs afero.Fs, path string, msgAndArgs ...interface{}) bool
- func Perm(t TestingT, fs afero.Fs, path string, expected os.FileMode, ...) bool
- func TreeContains(t TestingT, fs afero.Fs, tree FileTree, path string, msgAndArgs ...interface{}) bool
- func TreeEqual(t TestingT, fs afero.Fs, tree FileTree, path string, msgAndArgs ...interface{}) bool
- func YAMLTreeContains(t TestingT, fs afero.Fs, expected, path string, msgAndArgs ...interface{}) bool
- func YAMLTreeEqual(t TestingT, fs afero.Fs, expected, path string, msgAndArgs ...interface{}) bool
- type FileModeTags
- type FileNode
- type FileTree
- type TestingT
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFileNameEmpty indicates that the file name is empty. ErrFileNameEmpty = errors.New("file name is empty") // ErrInvalidFileTreeFormat indicates that format of the file tree is invalid and could not be parsed. ErrInvalidFileTreeFormat = errors.New("invalid file tree format") // ErrInvalidFileMode indicates that the file mode is invalid. ErrInvalidFileMode = errors.New("invalid file mode") )
Functions ¶
func DirExists ¶
DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
func Exists ¶
Exists checks whether a file or directory exists in the given path. It also fails if there is an error when trying to check the file.
func FileContent ¶
func FileContent(t TestingT, fs afero.Fs, path string, expected string, msgAndArgs ...interface{}) bool
FileContent checks whether a file content is as expected or not.
func FileContentRegexp ¶
func FileContentRegexp(t TestingT, fs afero.Fs, path string, expected interface{}, msgAndArgs ...interface{}) bool
FileContentRegexp checks whether a file content matches the expectation or not.
func FileExists ¶
FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
func FileModeFromUint64 ¶
FileModeFromUint64 returns *os.FileMode from an uint64.
func FileModePtr ¶
FileModePtr returns pointer to file mode.
func NoDirExists ¶
NoDirExists checks whether a directory does not exist in the given path. It fails if the path points to an existing _directory_ only.
func NoFileExists ¶
NoFileExists checks whether a file does not exist in a given path. It fails if the path points to an existing _file_ only.
func Perm ¶
func Perm(t TestingT, fs afero.Fs, path string, expected os.FileMode, msgAndArgs ...interface{}) bool
Perm checks whether a path has the expected permission or not.
func TreeContains ¶
func TreeContains(t TestingT, fs afero.Fs, tree FileTree, path string, msgAndArgs ...interface{}) bool
TreeContains checks whether a directory contains a file tree or not.
Types ¶
type FileModeTags ¶
FileModeTags is a list of tagged file mode.
func (FileModeTags) String ¶
func (t FileModeTags) String() string
String returns tags in struct tag format.
type FileNode ¶
type FileNode struct { Name string Tags FileModeTags Children FileTree IsDir bool }
FileNode contains needed information for assertions.
func (FileNode) MarshalYAML ¶
MarshalYAML satisfies yaml.Marshaler.
func (*FileNode) UnmarshalYAML ¶
UnmarshalYAML satisfies yaml.Unmarshaler.
type FileTree ¶
FileTree is a map of node.
func (FileTree) MarshalYAML ¶
MarshalYAML satisfies yaml.Marshaler.
func (*FileTree) UnmarshalYAML ¶
UnmarshalYAML satisfies yaml.Unmarshaler.