File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -441,7 +441,7 @@ pub use self::clap::{
441
441
442
442
#[ cfg( test) ]
443
443
mod value_parser_tests {
444
- use super :: { AsRange , ParseRenameFraction } ;
444
+ use super :: { AsRange , AsTime , ParseRenameFraction } ;
445
445
use clap:: Parser ;
446
446
447
447
#[ test]
@@ -479,4 +479,16 @@ mod value_parser_tests {
479
479
let c = Cmd :: parse_from ( [ "cmd" , "-l=1,10" ] ) ;
480
480
assert_eq ! ( c. arg, Some ( 1 ..10 ) ) ;
481
481
}
482
+
483
+ #[ test]
484
+ fn since ( ) {
485
+ #[ derive( Debug , clap:: Parser ) ]
486
+ pub struct Cmd {
487
+ #[ clap( long, long="since" , value_parser = AsTime ) ]
488
+ pub arg : Option < gix:: date:: Time > ,
489
+ }
490
+
491
+ let c = Cmd :: parse_from ( [ "cmd" , "--since" , "2 weeks ago" ] ) ;
492
+ assert ! ( matches!( c. arg, Some ( gix:: date:: Time { .. } ) ) ) ;
493
+ }
482
494
}
You can’t perform that action at this time.
0 commit comments