Expand description
Utilities for testing gitoxide
crates, many of which might be useful for testing programs that use git
in general.
§Feature Flags
xz
— Use instead of plaintar
files, compress these to producetar.xz
files instead. This is useful if archives are uploaded intogit-lfs
, which doesn’t have built-in compression and metering counts towards uncompressed bytes transferred.
Re-exports§
Structs§
- Auto
Revert ToPreviousCWD - A utility to set the current working dir to the given value, on drop.
- Env
- A utility to set and unset environment variables, while restoring or removing them on drop.
- GitDaemon
- A wrapper for a running git-daemon process which is killed automatically on drop.
Enums§
- Creation
- Define how
scripted_fixture_writable_with_args()
uses produces the writable copy.
Statics§
- GIT_
VERSION - The major, minor and patch level of the git version on the system.
Functions§
- bash_
program - Get the path attempted as a
bash
interpreter, for fixture scripts having no#!
we can use. - copy_
recursively_ into_ existing_ dir - A utility to copy the entire contents of
src_dir
intodst_dir
. - fixture_
bytes - Load the fixture from
<crate-root>/tests/fixtures/<path>
and return its data, or panic. - fixture_
bytes_ standalone - Like
scripted_fixture_writable
, but does not prefix the fixture directory withtests
- fixture_
path - Return the path to the
<crate-root>/tests/fixtures/<path>
directory. - fixture_
path_ standalone - Return the path to the
<crate-root>/fixtures/<path>
directory. - run_git
- Run
git
inworking_dir
with all providedargs
. - scripted_
fixture_ read_ only - Run the executable at
script_name
, likemake_repo.sh
ormy_setup.py
to produce a read-only directory to which the path is returned. - scripted_
fixture_ read_ only_ standalone - Like
scripted_fixture_read_only
, but does not prefix the fixture directory withtests
- scripted_
fixture_ read_ only_ with_ args - Like
scripted_fixture_read_only()
], but passesargs
toscript_name
. - scripted_
fixture_ read_ only_ with_ args_ single_ archive - Like
scripted_fixture_read_only()
], but passesargs
toscript_name
. - scripted_
fixture_ read_ only_ with_ args_ standalone - Like
scripted_fixture_read_only_with_args()
, but does not prefix the fixture directory withtests
- scripted_
fixture_ read_ only_ with_ args_ standalone_ single_ archive - Like
scripted_fixture_read_only_with_args_standalone()
, only has a single archive. - scripted_
fixture_ writable - Run the executable at
script_name
, likemake_repo.sh
to produce a writable directory to which the tempdir is returned. It will be removed automatically, courtesy oftempfile::TempDir
. - scripted_
fixture_ writable_ standalone - Like
scripted_fixture_writable
, but does not prefix the fixture directory withtests
- scripted_
fixture_ writable_ with_ args - Like
scripted_fixture_writable()
, but passesargs
toscript_name
while providing control over the way files are created withmode
. - scripted_
fixture_ writable_ with_ args_ single_ archive - Like
scripted_fixture_writable()
, but passesargs
toscript_name
while providing control over the way files are created withmode
. - scripted_
fixture_ writable_ with_ args_ standalone - Like
scripted_fixture_writable_with_args
, but does not prefix the fixture directory withtests
- scripted_
fixture_ writable_ with_ args_ standalone_ single_ archive - Like
scripted_fixture_writable_with_args
, but does not prefix the fixture directory withtests
- set_
current_ dir - Set the current working dir to
new_cwd
and return a type that returns to the previous working dir on drop. - should_
skip_ as_ git_ version_ is_ smaller_ than - Returns true if the given
major
,minor
andpatch
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. - size_ok
- Check data structure size, comparing strictly on 64-bit targets.
- spawn_
git_ daemon - Spawn a git daemon process to host all repository at or below
working_dir
. - to_
bstr_ err - Transform a verbose parser errors from raw bytes into a
BStr
to make printing/debugging human-readable. - umask
Unix - Get the umask in a way that is safe, but may be too slow for use outside of tests.
Type Aliases§
- Result
- A result type to allow using the try operator
?
in unit tests.