Struct lit::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,
}
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.

Implementations§

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.

Marks a file extension as supported by the runner.

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

Adds a search path to the test runner.

We will recurse through the path to find tests.

Checks if a given extension will have tests run on it

Looks up a variable.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.