Namespace: go.std.testing.fstest
v1.0Contents
Summary
Provides a low-level interface to the testing/fstest package.
Package fstest implements support for testing implementations and users of file systems.
Index
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
(None.)
Functions, Macros, and Special Forms
-
TestFS
Function v1.0(TestFS fsys & expected)
TestFS tests a file system implementation.
It walks the entire tree of files in fsys,
opening and checking that each file behaves correctly.
It also checks that the file system contains at least the expected files.
As a special case, if no expected files are listed, fsys must be empty.
Otherwise, fsys must contain at least the listed files; it can also contain others.
The contents of fsys must not change concurrently with TestFS.
If TestFS finds any misbehaviors, it returns an error reporting all of them.
The error text spans multiple lines, one per detected misbehavior.
Typical usage inside a test is:
if err := fstest.TestFS(myFS, "file/that/should/be/present"); err != nil {
t.Fatal(err)
}
Go input arguments: (fsys io/fs.FS, expected ...string)
Go returns: error
Joker input arguments: [^go.std.io.fs/FS fsys, & ^String expected]
Joker returns: ^Error
Types
-
*MapFS
Concrete Type v1.0A MapFS is a simple in-memory file system for use in tests,
represented as a map from path names (arguments to Open)
to information about the files or directories they represent.
The map need not include parent directories for files contained
in the map; those will be synthesized if needed.
But a directory can still be included by setting the MapFile.Mode's ModeDir bit;
this may be necessary for detailed control over the directory's FileInfo
or to create an empty directory.
File system operations read directly from the map,
so that the file system can be changed by editing the map as needed.
An implication is that file system operations must not run concurrently
with changes to the map, which would be a race.
Another implication is that opening or reading a directory requires
iterating over the entire map, so a MapFS should typically be used with not more
than a few hundred entries or directory reads.
-
*MapFile
Concrete Type v1.0A MapFile describes a single file in a MapFS.
-
MapFS
Concrete Type v1.0A MapFS is a simple in-memory file system for use in tests,
represented as a map from path names (arguments to Open)
to information about the files or directories they represent.
The map need not include parent directories for files contained
in the map; those will be synthesized if needed.
But a directory can still be included by setting the MapFile.Mode's ModeDir bit;
this may be necessary for detailed control over the directory's FileInfo
or to create an empty directory.
File system operations read directly from the map,
so that the file system can be changed by editing the map as needed.
An implication is that file system operations must not run concurrently
with changes to the map, which would be a race.
Another implication is that opening or reading a directory requires
iterating over the entire map, so a MapFS should typically be used with not more
than a few hundred entries or directory reads.
-
Glob
Receiver for MapFS v1.0([pattern])
-
Open
Receiver for MapFS v1.0([name])
Open opens the named file.
-
ReadDir
Receiver for MapFS v1.0([name])
-
ReadFile
Receiver for MapFS v1.0([name])
-
Stat
Receiver for MapFS v1.0([name])
-
Sub
Receiver for MapFS v1.0([dir])
-
MapFile
Concrete Type v1.0A MapFile describes a single file in a MapFS.
-
arrayOfMapFS
Concrete Type v1.0A MapFS is a simple in-memory file system for use in tests,
represented as a map from path names (arguments to Open)
to information about the files or directories they represent.
The map need not include parent directories for files contained
in the map; those will be synthesized if needed.
But a directory can still be included by setting the MapFile.Mode's ModeDir bit;
this may be necessary for detailed control over the directory's FileInfo
or to create an empty directory.
File system operations read directly from the map,
so that the file system can be changed by editing the map as needed.
An implication is that file system operations must not run concurrently
with changes to the map, which would be a race.
Another implication is that opening or reading a directory requires
iterating over the entire map, so a MapFS should typically be used with not more
than a few hundred entries or directory reads.
-
arrayOfMapFile
Concrete Type v1.0A MapFile describes a single file in a MapFS.