File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -224,20 +224,32 @@ impl Config {
224
224
/// Returns an [`Assert`] object to check the output of running the command
225
225
/// specified by `args` under the default environment.
226
226
#[ must_use]
227
- pub async fn expect ( & self , args : impl AsRef < [ & str ] > ) -> Assert {
227
+ pub async fn expect < S : AsRef < OsStr > + Clone + Debug > ( & self , args : impl AsRef < [ S ] > ) -> Assert {
228
228
self . expect_with_env ( args, & [ ] ) . await
229
229
}
230
230
231
231
/// Returns an [`Assert`] object to check the output of running the command
232
232
/// specified by `args` and under the environment specified by `env`.
233
233
#[ must_use]
234
- pub async fn expect_with_env (
234
+ pub async fn expect_with_env < S : AsRef < OsStr > + Clone + Debug > (
235
235
& self ,
236
- args : impl AsRef < [ & str ] > ,
236
+ args : impl AsRef < [ S ] > ,
237
237
env : impl AsRef < [ ( & str , & str ) ] > ,
238
238
) -> Assert {
239
- let args = args. as_ref ( ) ;
240
- let output = self . run ( args[ 0 ] , & args[ 1 ..] , env. as_ref ( ) ) . await ;
239
+ let ( program, args) = args
240
+ . as_ref ( )
241
+ . split_first ( )
242
+ . expect ( "args should not be empty" ) ;
243
+ let output = self
244
+ . run (
245
+ program
246
+ . as_ref ( )
247
+ . to_str ( )
248
+ . expect ( "invalid UTF-8 in program name" ) ,
249
+ args,
250
+ env. as_ref ( ) ,
251
+ )
252
+ . await ;
241
253
Assert :: new ( output)
242
254
}
243
255
You can’t perform that action at this time.
0 commit comments