assert_e2e in cargo_test_support::compare - Rust
Description: Assertion policy for functional end-to-end tests

Skip to main content

## assert_e2e

# Function assert_e2e

Source

    pub fn assert_e2e() -> Assert

Expand description

Assertion policy for functional end-to-end tests

This emphasizes showing as much content as possible at the cost of more brittleness

## §Snapshots

Updating of snapshots is controlled with the `SNAPSHOTS` environment variable:

- `skip`: do not run the tests
- `ignore`: run the tests but ignore their failure
- `verify`: run the tests
- `overwrite`: update the snapshots based on the output of the tests

## §Patterns

- `[..]` is a character wildcard, stopping at line breaks
- `\n...\n` is a multi-line wildcard
- `[EXE]` matches the exe suffix for the current platform
- `[ROOT]` matches `paths::root()`
- `[ROOTURL]` matches `paths::root()` as a URL

## §Normalization

In addition to the patterns described above, text is normalized in such a way to avoid unwanted differences. The normalizations are:

- Backslashes are converted to forward slashes to deal with Windows paths. This helps so that all tests can be written assuming forward slashes. Other heuristics are applied to try to ensure Windows-style paths aren’t a problem.
- Carriage returns are removed, which can help when running on Windows.

## §Example

    assert_e2e().eq(p.read_lockfile(), str![]);

    $ SNAPSHOTS=overwrite cargo test