File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -277,9 +277,11 @@ mod arg {
277
277
}
278
278
279
279
#[ test]
280
- #[ cfg( all( feature = "help" , featiure = "usage" ) ) ]
280
+ #[ cfg( all( feature = "help" , feature = "usage" ) ) ]
281
281
fn optional_value ( ) {
282
- let mut cmd = clap:: Command :: new ( "test" ) . arg ( clap:: arg!( port: -p [ NUM ] ) ) ;
282
+ let mut cmd = clap:: Command :: new ( "test" )
283
+ . args_override_self ( true )
284
+ . arg ( clap:: arg!( port: -p [ NUM ] ) ) ;
283
285
284
286
let r = cmd. try_get_matches_from_mut ( [ "test" , "-p42" ] ) ;
285
287
assert ! ( r. is_ok( ) , "{}" , r. unwrap_err( ) ) ;
@@ -299,17 +301,17 @@ mod arg {
299
301
assert ! ( m. contains_id( "port" ) ) ;
300
302
assert_eq ! ( m. get_one:: <String >( "port" ) . unwrap( ) , "42" ) ;
301
303
302
- let mut help = Vec :: new ( ) ;
303
- cmd . write_help ( & mut help ) . unwrap ( ) ;
304
- snapbox :: assert_eq (
305
- snapbox:: str![ [ " \
304
+ let help = cmd . render_help ( ) . to_string ( ) ;
305
+ snapbox :: assert_data_eq! (
306
+ help ,
307
+ snapbox:: str ![ [ r#"
306
308
Usage: test [OPTIONS]
307
309
308
310
Options:
309
311
-p [<NUM>]
310
- -h, --help Print help information
311
- " ] ] ,
312
- help ,
312
+ -h, --help Print help
313
+
314
+ "# ] ]
313
315
) ;
314
316
}
315
317
}
You can’t perform that action at this time.
0 commit comments