Struct lit::Config[][src]

pub struct Config {
    pub supported_file_extensions: Vec<String>,
    pub test_paths: Vec<PathBuf>,
    pub constants: HashMap<String, String>,
    pub variable_lookup: VariableLookup,
}

The configuration of the test runner.

Fields

A list of file extensions which contain tests.

Paths to tests or folders containing tests.

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

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.

Methods

impl Config
[src]

DEFAULT_VARIABLE_LOOKUP: VariableLookup = VariableLookup(|v|
                   {
                       if v.contains("tempfile")
                          {
                              let temp_file =
                                  <NamedTempFile>::new().expect("failed to create a temporary file");
                              Some(temp_file.into_temp_path().to_str().expect("temp file path is not utf-8").to_owned())
                          } else { None }
                       })

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

impl Clone for Config
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Config
[src]

Formats the value using the given formatter. Read more

impl Default for Config
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for Config

impl Sync for Config