test-binary 3.0.2

Manage and build extra binaries for integration tests as regular Rust crates.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! This creates a separate test binary so we can modify the environment
//! variables without affecting other tests.

use std::env::remove_var;
use test_binary::{build_test_binary, TestBinaryError};

// Test that the builder returns an error if it's not run under Cargo.
#[test]
fn test_non_cargo_env() {
    remove_var("CARGO");
    remove_var("CARGO_MANIFEST_DIR");
    let result = build_test_binary("does-build", "testbins");
    assert!(matches!(result, Err(TestBinaryError::NonCargoRun(_))));
}