MemoryGitFileSystem class final Testing

GitFileSystem kept entirely in memory, for tests without a disk.

Paths use the POSIX spelling: / separator, a single root at /, and relative paths resolved against the root. . and .. segments, repeated separators and Windows separators are normalized on every call, and .. above the root stays at the root. Nothing is ever written to the machine.

The seedFile, seedDirectory and seedLink helpers prepare the state a test starts from; the fileContent, hasFile and hasDirectory helpers let it assert the state a call left behind.

Implemented types

Constructors

MemoryGitFileSystem()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

absolutePath(String path) → String
Returns path as an absolute path, resolving relative paths against the implementation's current directory.
override
createDirectory(String path, {bool recursive = false}) → Future<void>
Creates a directory at path.
override
createTemporaryDirectory(String prefix) → Future<String>
Creates a fresh empty directory for temporary use and returns its absolute path. Two calls never return the same path.
override
deleteDirectory(String path, {bool recursive = false}) → Future<void>
Deletes the directory at path.
override
exists(String path) → Future<bool>
Whether anything — a file or a directory — exists at path.
override
fileContent(String path) → Uint8List?
The bytes of the file at path, or null when it holds none.
hasDirectory(String path) → bool
Whether a directory sits at path.
hasFile(String path) → bool
Whether a file sits at path.
isDirectory(String path) → Future<bool>
Whether a directory exists at path. A file at path yields false.
override
Whether a symbolic link or a Windows junction sits at path, without following it.
override
list(String path) → Future<List<GitFileSystemEntry>>
Lists the direct children of the directory at path, sorted by name.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readBytes(String path) → Future<Uint8List>
Reads the bytes of the file at path.
override
Resolves every symbolic link and Windows junction in path and returns the absolute path it designates.
override
seedDirectory(String path) → void
Creates the directory at path, with its missing parent directories, replacing whatever sits there.
seedFile(String path, List<int> bytes) → void
Writes bytes to the file at path, creating its missing parent directories, replacing whatever sits there.
Creates a symbolic link at path pointing at target, replacing whatever sits there.
toString() → String
A string representation of this object.
inherited
writeBytes(String path, List<int> bytes) → Future<void>
Writes bytes to the file at path, creating or replacing it.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited