Skip to content

Commit a676a95

Browse files
committed
refactor(snapbox)!: Move cargo_bin! to snapbox
1 parent b12a31f commit a676a95

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

crates/snapbox-macros/src/lib.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,6 @@ macro_rules! debug {
2929
($($arg:tt)*) => {};
3030
}
3131

32-
/// The absolute path to a binary target's executable.
33-
///
34-
/// The `bin_target_name` is the name of the binary
35-
/// target, exactly as-is.
36-
///
37-
/// **NOTE:** This is only set when building an integration test or benchmark.
38-
///
39-
/// ## Example
40-
///
41-
/// ```rust,no_run
42-
/// #[test]
43-
/// fn cli_tests() {
44-
/// trycmd::TestCases::new()
45-
/// .default_bin_path(trycmd::cargo_bin!("bin-fixture"))
46-
/// .case("tests/cmd/*.trycmd");
47-
/// }
48-
/// ```
49-
#[macro_export]
50-
macro_rules! cargo_bin {
51-
($bin_target_name:expr) => {
52-
::std::path::Path::new(env!(concat!("CARGO_BIN_EXE_", $bin_target_name)))
53-
};
54-
}
55-
5632
#[doc = include_str!("../README.md")]
5733
#[cfg(doctest)]
5834
pub struct ReadmeDoctests;

crates/snapbox/src/cmd.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,8 @@ fn wait(
845845
child.wait()
846846
}
847847

848-
pub use snapbox_macros::cargo_bin;
848+
#[doc(inline)]
849+
pub use crate::cargo_bin;
849850

850851
/// Look up the path to a cargo-built binary within an integration test.
851852
///

crates/snapbox/src/macros.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,31 @@ macro_rules! fn_path {
108108
}};
109109
}
110110

111+
/// The absolute path to a binary target's executable.
112+
///
113+
/// The `bin_target_name` is the name of the binary
114+
/// target, exactly as-is.
115+
///
116+
/// **NOTE:** This is only set when building an integration test or benchmark.
117+
///
118+
/// ## Example
119+
///
120+
/// ```rust,no_run
121+
/// #[test]
122+
/// fn cli_tests() {
123+
/// trycmd::TestCases::new()
124+
/// .default_bin_path(trycmd::cargo_bin!("bin-fixture"))
125+
/// .case("tests/cmd/*.trycmd");
126+
/// }
127+
/// ```
128+
#[macro_export]
129+
#[doc(hidden)]
130+
macro_rules! cargo_bin {
131+
($bin_target_name:expr) => {
132+
::std::path::Path::new(env!(concat!("CARGO_BIN_EXE_", $bin_target_name)))
133+
};
134+
}
135+
111136
#[cfg(test)]
112137
mod test {
113138
#[test]

0 commit comments

Comments
 (0)