File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/tutorial/testing/tests Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 1- use assert_cmd:: prelude :: * ; // Add methods on commands
1+ use assert_cmd:: cargo :: * ; // Import cargo_bin_cmd! macro and methods
22use predicates:: prelude:: * ; // Used for writing assertions
3- use std:: process:: Command ; // Run programs
43
54#[ test]
65fn file_doesnt_exist ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
7- let mut cmd = Command :: cargo_bin ( "grrs" ) ? ;
6+ let mut cmd = cargo_bin_cmd ! ( "grrs" ) ;
87
98 cmd. arg ( "foobar" ) . arg ( "test/file/doesnt/exist" ) ;
109 cmd. assert ( )
@@ -21,7 +20,7 @@ fn find_content_in_file() -> Result<(), Box<dyn std::error::Error>> {
2120 let file = assert_fs:: NamedTempFile :: new ( "sample.txt" ) ?;
2221 file. write_str ( "A test\n Actual content\n More content\n Another test" ) ?;
2322
24- let mut cmd = Command :: cargo_bin ( "grrs" ) ? ;
23+ let mut cmd = cargo_bin_cmd ! ( "grrs" ) ;
2524 cmd. arg ( "test" ) . arg ( file. path ( ) ) ;
2625 cmd. assert ( )
2726 . success ( )
You can’t perform that action at this time.
0 commit comments