File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -745,3 +745,36 @@ fn test_date_empty_tz_time() {
745745 . succeeds ( )
746746 . stdout_only ( "Thu Jan 1 00:00:00 UTC 1970\n " ) ;
747747}
748+
749+ #[ test]
750+ fn test_date_resolution ( ) {
751+ // Test that --resolution flag returns a floating point number by default
752+ new_ucmd ! ( )
753+ . arg ( "--resolution" )
754+ . succeeds ( )
755+ . stdout_str_check ( |s| s. trim ( ) . parse :: < f64 > ( ) . is_ok ( ) ) ;
756+
757+ // Test that --resolution flag can be passed twice to match gnu
758+ new_ucmd ! ( )
759+ . arg ( "--resolution" )
760+ . arg ( "--resolution" )
761+ . succeeds ( )
762+ . stdout_str_check ( |s| s. trim ( ) . parse :: < f64 > ( ) . is_ok ( ) ) ;
763+
764+ // Test that can --resolution output can be formatted as a date
765+ new_ucmd ! ( )
766+ . arg ( "--resolution" )
767+ . arg ( "-Iseconds" )
768+ . succeeds ( )
769+ . stdout_only ( "1970-01-01T00:00:00+00:00\n " ) ;
770+ }
771+
772+ #[ test]
773+ fn test_date_resolution_no_combine ( ) {
774+ // Test that date fails when --resolution flag is passed with date flag
775+ new_ucmd ! ( )
776+ . arg ( "--resolution" )
777+ . arg ( "-d" )
778+ . arg ( "2025-01-01" )
779+ . fails ( ) ;
780+ }
You can’t perform that action at this time.
0 commit comments