pub struct Project {
    pub(crate) root: PathBuf,
}
Expand description

A cargo project to run tests against.

See ProjectBuilder or Project::from_template to get started.

Fields§

§root: PathBuf

Implementations§

Copy the test project from a fixed state

Root of the project, ex: /path/to/cargo/target/cit/t0/foo

Project’s target dir, ex: /path/to/cargo/target/cit/t0/foo/target

Project’s debug dir, ex: /path/to/cargo/target/cit/t0/foo/target/debug

File url for root, ex: file:///path/to/cargo/target/cit/t0/foo

Path to an example built as a library. kind should be one of: “lib”, “rlib”, “staticlib”, “dylib”, “proc-macro” ex: /path/to/cargo/target/cit/t0/foo/target/debug/examples/libex.rlib

Path to a debug binary. ex: /path/to/cargo/target/cit/t0/foo/target/debug/foo

Path to a release binary. ex: /path/to/cargo/target/cit/t0/foo/target/release/foo

Path to a debug binary for a specific target triple. ex: /path/to/cargo/target/cit/t0/foo/target/i686-apple-darwin/debug/foo

Returns an iterator of paths matching the glob pattern, which is relative to the project root.

Changes the contents of an existing file.

Creates a ProcessBuilder to run a program in the project and wrap it in an Execs to assert on the execution. Example: p.process(&p.bin(“foo”)) .with_stdout(“bar\n”) .run();

Creates a ProcessBuilder to run cargo. Arguments can be separated by spaces. Example: p.cargo(“build –bin foo”).run();

Safely run a process after cargo build.

Windows has a problem where a process cannot be reliably be replaced, removed, or renamed immediately after executing it. The action may fail (with errors like Access is denied), or it may succeed, but future attempts to use the same filename will fail with “Already Exists”.

If you have a test that needs to do cargo run multiple times, you should instead use cargo build and use this method to run the executable. Each time you call this, use a new name for dst. See rust-lang/cargo#5481.

Returns the contents of Cargo.lock.

Returns the contents of a path in the project root

Modifies Cargo.toml to remove all commented lines.

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.

Should always be Self
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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes