Crate tux

source · []
Expand description

This library provides miscellaneous utility functions for unit and integration tests in Rust.

Crate Features

Most crate features are enabled by default. The only exception are overly-specific features that are costly to build.

Not enabled by default:

All other features are enabled by default:

  • diff: support for the text diff functions.
  • exec: support for the binary execution functions.
  • temp: helpers for managing temporary directories and files.
  • testdata: support for file based tests.
  • text: text utility functions.

To disable the default features and opt into specific ones, change the dependency in your Cargo.toml:

[dependencies]
tux = { version = "...", default-features = false, features = ["..."] }

Re-exports

pub use tokio;
pub use warp;

Modules

Utilities for computing the difference between sequences.

General text utilities for tests.

Macros

Asserts that an expression panics with the specified message.

Structs

Manages a temporary directory that can be used by tests. Supports creating files in the directory. Once the value is dropped the entire directory and its contents are deleted.

Provides a very simple HTTP server with warp that can be used to test requests.

Functions

Returns a Command for running a binary from the project (i.e. a binary built by Cargo).

Utility function to retrieve the standard output of a process from the std::process::Output while validating the exit status and error output.

Convenience function combining get_bin and get_process_output.

Generates a temporary directory that can be used by tests. Returns a TempDir value that provides access to the created directory.

Test all .input files in the given directory (recursively) using the callback and compare the result with the expected output provided by a .valid file alongside the input.