Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
lib.rs - source
[go: Go Back, main page]

snapbox_macros/
lib.rs

1#![cfg_attr(docsrs, feature(doc_auto_cfg))]
2#![warn(clippy::print_stderr)]
3#![warn(clippy::print_stdout)]
4
5#[cfg(feature = "color")]
6pub use anstream::eprint;
7#[cfg(feature = "color")]
8pub use anstream::eprintln;
9#[cfg(not(feature = "color"))]
10pub use std::eprint;
11#[cfg(not(feature = "color"))]
12pub use std::eprintln;
13
14/// Feature-flag controlled additional test debug information
15#[cfg(feature = "debug")]
16#[macro_export]
17macro_rules! debug {
18    ($($arg:tt)*) => ({
19        $crate::eprint!("[{:>w$}] \t", module_path!(), w = 28);
20        $crate::eprintln!($($arg)*);
21    })
22}
23
24/// Feature-flag controlled additional test debug information
25#[cfg(not(feature = "debug"))]
26#[macro_export]
27macro_rules! debug {
28    ($($arg:tt)*) => {};
29}
30
31/// The absolute path to a binary target's executable.
32///
33/// The `bin_target_name` is the name of the binary
34/// target, exactly as-is.
35///
36/// **NOTE:** This is only set when building an integration test or benchmark.
37///
38/// ## Example
39///
40/// ```rust,no_run
41/// #[test]
42/// fn cli_tests() {
43///     trycmd::TestCases::new()
44///         .default_bin_path(trycmd::cargo_bin!("bin-fixture"))
45///         .case("tests/cmd/*.trycmd");
46/// }
47/// ```
48#[macro_export]
49macro_rules! cargo_bin {
50    ($bin_target_name:expr) => {
51        ::std::path::Path::new(env!(concat!("CARGO_BIN_EXE_", $bin_target_name)))
52    };
53}