File tree 8 files changed +818
-548
lines changed
8 files changed +818
-548
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,10 @@ assert_cmd = "0.11"
21
21
Here's a trivial example:
22
22
23
23
``` rust,no_run
24
- extern crate assert_cmd;
24
+ use assert_cmd::Command ;
25
25
26
- use std::process::Command;
27
- use assert_cmd::prelude::*;
28
-
29
- Command::cargo_bin("bin_fixture")
30
- .unwrap()
31
- .assert()
32
- .success();
26
+ let mut cmd = Command::cargo_bin("bin_fixture").unwrap();
27
+ cmd.assert().success();
33
28
```
34
29
35
30
## Relevant crates
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ use predicates::str::PredicateStrExt;
11
11
use predicates_core;
12
12
use predicates_tree:: CaseTreeExt ;
13
13
14
- use crate :: cmd :: dump_buffer;
15
- use crate :: cmd :: output_fmt;
14
+ use crate :: output :: dump_buffer;
15
+ use crate :: output :: output_fmt;
16
16
17
17
/// Assert the state of an [`Output`].
18
18
///
Original file line number Diff line number Diff line change @@ -124,14 +124,24 @@ where
124
124
fn cargo_bin < S : AsRef < str > > ( name : S ) -> Result < Self , CargoError > ;
125
125
}
126
126
127
+ impl CommandCargoExt for crate :: cmd:: Command {
128
+ fn cargo_bin < S : AsRef < str > > ( name : S ) -> Result < Self , CargoError > {
129
+ crate :: cmd:: Command :: cargo_bin ( name)
130
+ }
131
+ }
132
+
127
133
impl CommandCargoExt for process:: Command {
128
134
fn cargo_bin < S : AsRef < str > > ( name : S ) -> Result < Self , CargoError > {
129
- let path = cargo_bin ( name) ;
130
- if path. is_file ( ) {
131
- Ok ( process:: Command :: new ( path) )
132
- } else {
133
- Err ( CargoError :: with_cause ( NotFoundError { path } ) )
134
- }
135
+ cargo_bin_cmd ( name)
136
+ }
137
+ }
138
+
139
+ pub ( crate ) fn cargo_bin_cmd < S : AsRef < str > > ( name : S ) -> Result < process:: Command , CargoError > {
140
+ let path = cargo_bin ( name) ;
141
+ if path. is_file ( ) {
142
+ Ok ( process:: Command :: new ( path) )
143
+ } else {
144
+ Err ( CargoError :: with_cause ( NotFoundError { path } ) )
135
145
}
136
146
}
137
147
You can’t perform that action at this time.
0 commit comments