File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1- use assert_cmd:: cmd :: Command ;
1+ use assert_cmd:: cargo :: cargo_bin_cmd ;
22
33#[ test]
44fn invalid_config_will_cause_commands_to_fail ( ) {
5- let mut cmd = Command :: cargo_bin ( "spl-token" ) . unwrap ( ) ;
6- cmd. args ( [ "address" , "--config" , "~/nonexistent/config.yml" ] ) ;
7- cmd. assert ( )
8- . stderr ( "error: Could not find config file `~/nonexistent/config.yml`\n " ) ;
9- cmd. assert ( ) . code ( 1 ) . failure ( ) ;
5+ let output = cargo_bin_cmd ! ( "spl-token" )
6+ . args ( [ "address" , "--config" , "~/nonexistent/config.yml" ] )
7+ . output ( )
8+ . unwrap ( ) ;
9+ assert_eq ! (
10+ std:: str :: from_utf8( & output. stderr) . unwrap( ) ,
11+ "error: Could not find config file `~/nonexistent/config.yml`\n "
12+ ) ;
13+ assert_eq ! ( output. status. code( ) . unwrap( ) , 1 ) ;
14+ assert ! ( !output. status. success( ) ) ;
1015}
You can’t perform that action at this time.
0 commit comments