Struct Config

Source
pub struct Config {
    pub supported_file_extensions: Vec<String>,
    pub test_paths: Vec<PathBuf>,
    pub constants: HashMap<String, String>,
    pub variable_lookup: VariableLookup,
    pub cleanup_temporary_files: bool,
    pub save_artifacts_to_directory: Option<PathBuf>,
    pub dump_variable_resolution: bool,
    pub truncate_output_context_to_number_of_lines: Option<usize>,
    pub extra_executable_search_paths: Vec<PathBuf>,
    pub always_show_stderr: bool,
    pub shell: String,
}
Expand description

The configuration of the test runner.

Fields§

§supported_file_extensions: Vec<String>

A list of file extensions which contain tests.

§test_paths: Vec<PathBuf>

Paths to tests or folders containing tests.

§constants: HashMap<String, String>

Constants that tests can refer to via @<name> syntax.

§variable_lookup: VariableLookup

A function which used to dynamically lookup variables.

The default variable lookup can be found at Config::DEFAULT_VARIABLE_LOOKUP.

In your own custom variable lookups, most of the time you will want to include a fallback call to Config::DEFAULT_VARIABLE_LOOKUP.

§cleanup_temporary_files: bool

Whether temporary files generated by the tests should be cleaned up, where possible.

This includes temporary files created by using @tempfile variables.

§save_artifacts_to_directory: Option<PathBuf>

Export all generated test artifacts to the specified directory.

§dump_variable_resolution: bool

Whether verbose information about resolved variables should be printed to stderr.

§truncate_output_context_to_number_of_lines: Option<usize>

If set, debug output should be truncated to this many number of context lines.

§extra_executable_search_paths: Vec<PathBuf>

A list of extra directory paths that should be included in the $PATH when executing processes specified inside the tests.

§always_show_stderr: bool

Whether messages on the standard error streams emitted during test runs should always be shown.

§shell: String

Which shell to use (defaults to ‘bash’).

Implementations§

Source§

impl Config

Source

pub const DEFAULT_VARIABLE_LOOKUP: VariableLookup

The default variable lookup function.

The supported variables are:

  • Any variable containing the string "tempfile"
    • Each distinct variable will be resolved to a distinct temporary file path.
Source

pub fn add_extension<S>(&mut self, ext: S)
where S: AsRef<str>,

Marks a file extension as supported by the runner.

We only attempt to run tests for files within the extension whitelist.

Source

pub fn add_extensions(&mut self, extensions: &[&str])

Marks multiple file extensions as supported by the running.

Source

pub fn add_search_path<P>(&mut self, path: P)
where P: Into<String>,

Adds a search path to the test runner.

We will recurse through the path to find tests.

Source

pub fn add_executable_search_path<P>(&mut self, path: P)
where P: AsRef<Path>,

Adds an extra executable directory to the OS $PATH when executing tests.

Source

pub fn test_search_directories(&self) -> impl Iterator<Item = &Path>

Gets an iterator over all test search directories.

Source

pub fn is_extension_supported(&self, extension: &str) -> bool

Checks if a given extension will have tests run on it

Source

pub fn lookup_variable<'a>( &self, name: &str, variables: &'a mut HashMap<String, String>, ) -> &'a str

Looks up a variable.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V