@@ -110,6 +110,20 @@ fn help_with_man_and_path(
110
110
assert_eq ! ( stdout, contents) ;
111
111
}
112
112
113
+ fn help_with_stdout_and_path ( subcommand : & str , path : & Path ) -> String {
114
+ let output = process ( & cargo_exe ( ) )
115
+ . arg ( "help" )
116
+ . arg ( subcommand)
117
+ . env ( "PATH" , path)
118
+ . exec_with_output ( )
119
+ . unwrap ( ) ;
120
+ assert ! ( output. status. success( ) ) ;
121
+ let stderr = from_utf8 ( & output. stderr ) . unwrap ( ) ;
122
+ assert_eq ! ( stderr, "" ) ;
123
+ let stdout = from_utf8 ( & output. stdout ) . unwrap ( ) ;
124
+ stdout. to_string ( )
125
+ }
126
+
113
127
#[ cargo_test]
114
128
fn help_man ( ) {
115
129
// Checks that `help command` displays the man page using the given command.
@@ -124,7 +138,8 @@ fn help_man() {
124
138
#[ cargo_test]
125
139
fn help_alias ( ) {
126
140
// Check that `help some_alias` will resolve.
127
- help_with_man_and_path ( "" , "b" , "build" , Path :: new ( "" ) ) ;
141
+ let out = help_with_stdout_and_path ( "b" , Path :: new ( "" ) ) ;
142
+ assert_eq ! ( out, "'b' is aliased to 'build'\n " ) ;
128
143
129
144
let config = paths:: root ( ) . join ( ".cargo/config" ) ;
130
145
fs:: create_dir_all ( config. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
@@ -136,7 +151,8 @@ fn help_alias() {
136
151
"# ,
137
152
)
138
153
. unwrap ( ) ;
139
- help_with_man_and_path ( "" , "my-alias" , "build" , Path :: new ( "" ) ) ;
154
+ let out = help_with_stdout_and_path ( "my-alias" , Path :: new ( "" ) ) ;
155
+ assert_eq ! ( out, "'my-alias' is aliased to 'build --release'\n " ) ;
140
156
}
141
157
142
158
#[ cargo_test]
0 commit comments