File tree Expand file tree Collapse file tree 3 files changed +34
-25
lines changed Expand file tree Collapse file tree 3 files changed +34
-25
lines changed Original file line number Diff line number Diff 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) ]
5834pub struct ReadmeDoctests ;
Original file line number Diff line number Diff line change @@ -845,11 +845,16 @@ 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///
852853/// **NOTE:** Prefer [`cargo_bin!`] as this makes assumptions about cargo
854+ #[ deprecated(
855+ since = "0.6.23" ,
856+ note = "incompatible with a custom cargo build-dir, see instead `cmd::cargo_bin!`"
857+ ) ]
853858pub fn cargo_bin ( name : & str ) -> std:: path:: PathBuf {
854859 let file_name = format ! ( "{}{}" , name, std:: env:: consts:: EXE_SUFFIX ) ;
855860 let target_dir = target_dir ( ) ;
Original file line number Diff line number Diff line change @@ -108,6 +108,34 @@ 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+ ( ) => {
132+ $crate:: cmd:: cargo_bin!( env!( "CARGO_PKG_NAME" ) )
133+ } ;
134+ ( $bin_target_name: expr) => {
135+ :: std:: path:: Path :: new( env!( concat!( "CARGO_BIN_EXE_" , $bin_target_name) ) )
136+ } ;
137+ }
138+
111139#[ cfg( test) ]
112140mod test {
113141 #[ test]
You can’t perform that action at this time.
0 commit comments