File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 99//!
1010//! ```rust,no_run
1111//! use assert_cmd::prelude::*;
12+ //! use assert_cmd::pkg_name;
1213//!
1314//! use std::process::Command;
1415//!
15- //! let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME" ))
16+ //! let mut cmd = Command::cargo_bin(pkg_name!( ))
1617//! .unwrap();
1718//! let output = cmd.unwrap();
1819//! ```
@@ -74,10 +75,11 @@ pub use crate::cargo_bin;
7475///
7576/// ```rust,no_run
7677/// use assert_cmd::prelude::*;
78+ /// use assert_cmd::pkg_name;
7779///
7880/// use std::process::Command;
7981///
80- /// let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME" ))
82+ /// let mut cmd = Command::cargo_bin(pkg_name!( ))
8183/// .unwrap();
8284/// let output = cmd.unwrap();
8385/// println!("{:?}", output);
@@ -104,10 +106,11 @@ where
104106 ///
105107 /// ```rust,no_run
106108 /// use assert_cmd::prelude::*;
109+ /// use assert_cmd::pkg_name;
107110 ///
108111 /// use std::process::Command;
109112 ///
110- /// let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME" ))
113+ /// let mut cmd = Command::cargo_bin(pkg_name!( ))
111114 /// .unwrap();
112115 /// let output = cmd.unwrap();
113116 /// println!("{:?}", output);
Original file line number Diff line number Diff line change @@ -43,8 +43,9 @@ impl Command {
4343 ///
4444 /// ```rust,no_run
4545 /// use assert_cmd::Command;
46+ /// use assert_cmd::pkg_name;
4647 ///
47- /// let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME" ))
48+ /// let mut cmd = Command::cargo_bin(pkg_name!( ))
4849 /// .unwrap();
4950 /// let output = cmd.unwrap();
5051 /// println!("{:?}", output);
Original file line number Diff line number Diff line change 11use std:: process:: Command ;
22
3+ use assert_cmd:: pkg_name;
34use assert_cmd:: prelude:: * ;
45use escargot:: CURRENT_TARGET ;
56
@@ -41,15 +42,15 @@ fn mod_example() {
4142#[ test]
4243#[ should_panic] // No bin named `assert_cmd
4344fn trait_example ( ) {
44- let mut cmd = Command :: cargo_bin ( env ! ( "CARGO_PKG_NAME" ) ) . unwrap ( ) ;
45+ let mut cmd = Command :: cargo_bin ( pkg_name ! ( ) ) . unwrap ( ) ;
4546 let output = cmd. unwrap ( ) ;
4647 println ! ( "{output:?}" ) ;
4748}
4849
4950#[ test]
5051#[ should_panic] // No bin named `assert_cmd
5152fn cargo_bin_example_1 ( ) {
52- let mut cmd = Command :: cargo_bin ( env ! ( "CARGO_PKG_NAME" ) ) . unwrap ( ) ;
53+ let mut cmd = Command :: cargo_bin ( pkg_name ! ( ) ) . unwrap ( ) ;
5354 let output = cmd. unwrap ( ) ;
5455 println ! ( "{output:?}" ) ;
5556}
You can’t perform that action at this time.
0 commit comments