@@ -192,6 +192,8 @@ const fn empty_table_style() -> TableStyle {
192192}
193193
194194mod test {
195+ use std:: time:: Duration ;
196+
195197 #[ test]
196198 fn test_safe_base64_parse_option ( ) {
197199 let base64_option = "config_b64=eyJhZGRyZXNzIjogIjAuMC4wLjA6ODA4MCJ9Cg==" . to_string ( ) ;
@@ -203,4 +205,36 @@ mod test {
203205 let output = crate :: lib:: cli:: input_vec_to_hashmap ( vec ! [ base64_option] ) . unwrap ( ) ;
204206 assert_eq ! ( expected, output) ;
205207 }
208+
209+ #[ test]
210+ fn test_parse_duration_fallback_ms ( ) {
211+ // Test humantime format
212+ assert_eq ! (
213+ crate :: util:: parse_duration_fallback_ms( "5s" ) . unwrap( ) ,
214+ Duration :: from_secs( 5 )
215+ ) ;
216+ assert_eq ! (
217+ crate :: util:: parse_duration_fallback_ms( "100ms" ) . unwrap( ) ,
218+ Duration :: from_millis( 100 )
219+ ) ;
220+ assert_eq ! (
221+ crate :: util:: parse_duration_fallback_ms( "2m" ) . unwrap( ) ,
222+ Duration :: from_secs( 120 )
223+ ) ;
224+
225+ // Test milliseconds fallback
226+ assert_eq ! (
227+ crate :: util:: parse_duration_fallback_ms( "1000" ) . unwrap( ) ,
228+ Duration :: from_millis( 1000 )
229+ ) ;
230+ assert_eq ! (
231+ crate :: util:: parse_duration_fallback_ms( "500" ) . unwrap( ) ,
232+ Duration :: from_millis( 500 )
233+ ) ;
234+
235+ // Test error cases
236+ assert ! ( crate :: util:: parse_duration_fallback_ms( "invalid" ) . is_err( ) ) ;
237+ assert ! ( crate :: util:: parse_duration_fallback_ms( "" ) . is_err( ) ) ;
238+ assert ! ( crate :: util:: parse_duration_fallback_ms( "abc123" ) . is_err( ) ) ;
239+ }
206240}
0 commit comments