Crate git_testtools
source ·Expand description
Utilities for testing gitoxide
crates, many of which might be useful for testing programs that use git
in general.
Re-exports
Structs
A utility to set environment variables, while unsetting them (or resetting them to their previous value) on drop.
A wrapper for a running git-daemon process which is killed automatically on drop.
Enums
Define how scripted_fixture_writable_with_args() uses produces the writable copy.
Statics
The major, minor and patch level of the git version on the system.
Functions
A utility to copy the entire contents of
src_dir
into dst_dir
.Load the fixture from
<crate-root>/tests/fixtures/<path>
and return its data, or panic.Return the path to the
<crate-root>/tests/fixtures/<path>
directory.Convert a hexadecimal hash into its corresponding
ObjectId
or panic.Run
git
in working_dir
with all provided args
.Run the executable at
script_name
, like make_repo.sh
or my_setup.py
to produce a read-only directory to which
the path is returned.Like
scripted_fixture_read_only()
], but passes args
to script_name
.Run the executable at
script_name
, like make_repo.sh
to produce a writable directory to which
the tempdir is returned. It will be removed automatically, courtesy of tempfile::TempDir
.Like
scripted_fixture_writable()
, but passes args
to script_name
while providing control over
the way files are created with mode
.Returns true if the given
major
, minor
and patch
is smaller than the actual git version on the system
to facilitate skipping a test on the caller.
Will never return true on CI which is expected to have a recent enough git version.Spawn a git daemon process to host all repository at or below
working_dir
.Transform a verbose bom errors from raw bytes into a
BStr
to make printing/debugging human-readable.Type Definitions
A result type to allow using the try operator
?
in unit tests.