foundry_test_utils/lib.rs
1//! # foundry-test-utils
2//!
3//! Internal Foundry testing utilities.
4
5#![cfg_attr(not(test), warn(unused_crate_dependencies))]
6#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
7// Shouldn't use sh_* macros here, as they don't get captured by the test runner.
8#![allow(clippy::disallowed_macros)]
9
10#[macro_use]
11extern crate tracing;
12
13// See /Cargo.toml.
14use idna_adapter as _;
15use zip_extract as _;
16
17// Macros useful for testing.
18mod macros;
19
20pub mod rpc;
21
22pub mod fd_lock;
23
24mod filter;
25pub use filter::Filter;
26
27// Utilities for making it easier to handle tests.
28pub mod util;
29pub use util::{TestCommand, TestProject};
30
31mod script;
32pub use script::{ScriptOutcome, ScriptTester};
33
34pub mod ui_runner;
35
36// re-exports for convenience
37pub use foundry_compilers;
38
39pub use snapbox::{self, assert_data_eq, file, str};
40
41/// Initializes tracing for tests.
42pub fn init_tracing() {
43 let _ = tracing_subscriber::FmtSubscriber::builder()
44 .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
45 .try_init();
46}