1- use assert_cmd:: Command ;
1+ use assert_cmd:: cargo :: cargo_bin_cmd ;
22use predicates:: prelude:: * ;
33use std:: { error:: Error , fs} ;
44
@@ -11,7 +11,7 @@ pub fn stripped_output(output: Vec<u8>) -> String {
1111#[ test]
1212fn test_check_with_privacy_dependency_error_template_overrides (
1313) -> Result < ( ) , Box < dyn Error > > {
14- let output = Command :: cargo_bin ( "pks" ) ?
14+ let output = cargo_bin_cmd ! ( "pks" )
1515 . arg ( "--project-root" )
1616 . arg ( "tests/fixtures/privacy_violation_overrides" )
1717 . arg ( "--debug" )
@@ -33,7 +33,7 @@ fn test_check_with_privacy_dependency_error_template_overrides(
3333}
3434#[ test]
3535fn test_check ( ) -> Result < ( ) , Box < dyn Error > > {
36- let output = Command :: cargo_bin ( "pks" ) ?
36+ let output = cargo_bin_cmd ! ( "pks" )
3737 . arg ( "--project-root" )
3838 . arg ( "tests/fixtures/simple_app" )
3939 . arg ( "--debug" )
@@ -56,7 +56,7 @@ fn test_check() -> Result<(), Box<dyn Error>> {
5656
5757#[ test]
5858fn test_check_enforce_privacy_disabled ( ) -> Result < ( ) , Box < dyn Error > > {
59- let output = Command :: cargo_bin ( "pks" ) ?
59+ let output = cargo_bin_cmd ! ( "pks" )
6060 . arg ( "--project-root" )
6161 . arg ( "tests/fixtures/simple_app" )
6262 . arg ( "--debug" )
@@ -79,7 +79,7 @@ fn test_check_enforce_privacy_disabled() -> Result<(), Box<dyn Error>> {
7979
8080#[ test]
8181fn test_check_enforce_dependency_disabled ( ) -> Result < ( ) , Box < dyn Error > > {
82- let output = Command :: cargo_bin ( "pks" ) ?
82+ let output = cargo_bin_cmd ! ( "pks" )
8383 . arg ( "--project-root" )
8484 . arg ( "tests/fixtures/simple_app" )
8585 . arg ( "--debug" )
@@ -102,7 +102,7 @@ fn test_check_enforce_dependency_disabled() -> Result<(), Box<dyn Error>> {
102102
103103#[ test]
104104fn test_check_with_single_file ( ) -> Result < ( ) , Box < dyn Error > > {
105- let output = Command :: cargo_bin ( "pks" ) ?
105+ let output = cargo_bin_cmd ! ( "pks" )
106106 . arg ( "--project-root" )
107107 . arg ( "tests/fixtures/simple_app" )
108108 . arg ( "--debug" )
@@ -127,7 +127,7 @@ fn test_check_with_single_file() -> Result<(), Box<dyn Error>> {
127127#[ test]
128128fn test_check_with_single_file_experimental_parser (
129129) -> Result < ( ) , Box < dyn Error > > {
130- let output = Command :: cargo_bin ( "pks" ) ?
130+ let output = cargo_bin_cmd ! ( "pks" )
131131 . arg ( "--project-root" )
132132 . arg ( "tests/fixtures/simple_app" )
133133 . arg ( "--debug" )
@@ -152,7 +152,7 @@ fn test_check_with_single_file_experimental_parser(
152152
153153#[ test]
154154fn test_check_with_package_todo_file ( ) -> Result < ( ) , Box < dyn Error > > {
155- Command :: cargo_bin ( "pks" ) ?
155+ cargo_bin_cmd ! ( "pks" )
156156 . arg ( "--project-root" )
157157 . arg ( "tests/fixtures/contains_package_todo" )
158158 . arg ( "--debug" )
@@ -168,7 +168,7 @@ fn test_check_with_package_todo_file() -> Result<(), Box<dyn Error>> {
168168
169169#[ test]
170170fn test_check_with_package_todo_file_csv ( ) -> Result < ( ) , Box < dyn Error > > {
171- Command :: cargo_bin ( "pks" ) ?
171+ cargo_bin_cmd ! ( "pks" )
172172 . arg ( "--project-root" )
173173 . arg ( "tests/fixtures/contains_package_todo" )
174174 . arg ( "--debug" )
@@ -188,7 +188,7 @@ fn test_check_with_package_todo_file_csv() -> Result<(), Box<dyn Error>> {
188188#[ test]
189189fn test_check_with_package_todo_file_ignoring_recorded_violations (
190190) -> Result < ( ) , Box < dyn Error > > {
191- let output = Command :: cargo_bin ( "pks" ) ?
191+ let output = cargo_bin_cmd ! ( "pks" )
192192 . arg ( "--project-root" )
193193 . arg ( "tests/fixtures/contains_package_todo" )
194194 . arg ( "--debug" )
@@ -212,8 +212,7 @@ fn test_check_with_package_todo_file_ignoring_recorded_violations(
212212
213213#[ test]
214214fn test_check_with_experimental_parser ( ) -> Result < ( ) , Box < dyn Error > > {
215- let output = Command :: cargo_bin ( "pks" )
216- . unwrap ( )
215+ let output = cargo_bin_cmd ! ( "pks" )
217216 . arg ( "--project-root" )
218217 . arg ( "tests/fixtures/simple_app" )
219218 . arg ( "--experimental-parser" )
@@ -237,8 +236,7 @@ fn test_check_with_experimental_parser() -> Result<(), Box<dyn Error>> {
237236
238237#[ test]
239238fn test_check_with_stale_violations ( ) -> Result < ( ) , Box < dyn Error > > {
240- Command :: cargo_bin ( "pks" )
241- . unwrap ( )
239+ cargo_bin_cmd ! ( "pks" )
242240 . arg ( "--project-root" )
243241 . arg ( "tests/fixtures/contains_stale_violations" )
244242 . arg ( "check" )
@@ -255,8 +253,7 @@ fn test_check_with_stale_violations() -> Result<(), Box<dyn Error>> {
255253#[ test]
256254fn test_check_with_stale_violations_when_file_no_longer_exists (
257255) -> Result < ( ) , Box < dyn Error > > {
258- Command :: cargo_bin ( "pks" )
259- . unwrap ( )
256+ cargo_bin_cmd ! ( "pks" )
260257 . arg ( "--project-root" )
261258 . arg ( "tests/fixtures/contains_stale_violations_no_file" )
262259 . arg ( "check" )
@@ -272,8 +269,7 @@ fn test_check_with_stale_violations_when_file_no_longer_exists(
272269
273270#[ test]
274271fn test_check_with_relationship_violations ( ) -> Result < ( ) , Box < dyn Error > > {
275- Command :: cargo_bin ( "pks" )
276- . unwrap ( )
272+ cargo_bin_cmd ! ( "pks" )
277273 . arg ( "--project-root" )
278274 . arg ( "tests/fixtures/app_with_rails_relationships" )
279275 . arg ( "check" )
@@ -289,8 +285,7 @@ fn test_check_with_relationship_violations() -> Result<(), Box<dyn Error>> {
289285
290286#[ test]
291287fn test_check_without_stale_violations ( ) -> Result < ( ) , Box < dyn Error > > {
292- Command :: cargo_bin ( "pks" )
293- . unwrap ( )
288+ cargo_bin_cmd ! ( "pks" )
294289 . arg ( "--project-root" )
295290 . arg ( "tests/fixtures/contains_package_todo" )
296291 . arg ( "check" )
@@ -309,8 +304,7 @@ fn test_check_without_stale_violations() -> Result<(), Box<dyn Error>> {
309304
310305#[ test]
311306fn test_check_with_strict_mode ( ) -> Result < ( ) , Box < dyn Error > > {
312- Command :: cargo_bin ( "pks" )
313- . unwrap ( )
307+ cargo_bin_cmd ! ( "pks" )
314308 . arg ( "--project-root" )
315309 . arg ( "tests/fixtures/uses_strict_mode" )
316310 . arg ( "check" )
@@ -329,8 +323,7 @@ fn test_check_with_strict_mode() -> Result<(), Box<dyn Error>> {
329323
330324#[ test]
331325fn test_check_with_strict_mode_output_csv ( ) -> Result < ( ) , Box < dyn Error > > {
332- Command :: cargo_bin ( "pks" )
333- . unwrap ( )
326+ cargo_bin_cmd ! ( "pks" )
334327 . arg ( "--project-root" )
335328 . arg ( "tests/fixtures/uses_strict_mode" )
336329 . arg ( "check" )
@@ -354,7 +347,7 @@ fn test_check_contents() -> Result<(), Box<dyn Error>> {
354347 let foo_rb_contents =
355348 fs:: read_to_string ( format ! ( "{}/{}" , project_root, relative_path) ) ?;
356349
357- let output = Command :: cargo_bin ( "pks" ) ?
350+ let output = cargo_bin_cmd ! ( "pks" )
358351 . arg ( "--project-root" )
359352 . arg ( project_root)
360353 . arg ( "--debug" )
@@ -385,7 +378,7 @@ fn test_check_contents_ignoring_recorded_violations(
385378 let foo_rb_contents =
386379 fs:: read_to_string ( format ! ( "{}/{}" , project_root, relative_path) ) ?;
387380
388- let output = Command :: cargo_bin ( "pks" ) ?
381+ let output = cargo_bin_cmd ! ( "pks" )
389382 . arg ( "--project-root" )
390383 . arg ( project_root)
391384 . arg ( "--debug" )
0 commit comments