File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -616,7 +616,7 @@ impl<A> Copy for Date<A> where A: AsCalendar + Copy {}
616616#[ cfg( test) ]
617617mod tests {
618618 use super :: * ;
619- use crate :: types:: Weekday ;
619+ use crate :: { Gregorian , cal :: { Buddhist , Hebrew } , types:: Weekday } ;
620620
621621 #[ test]
622622 fn test_ord ( ) {
@@ -665,4 +665,15 @@ mod tests {
665665 Weekday :: Tuesday ,
666666 ) ;
667667 }
668+
669+ #[ test]
670+ fn test_to_calendar ( ) {
671+ let date = Date :: try_new_gregorian ( 2025 , 12 , 9 ) . unwrap ( ) ;
672+ // These conversions uses the AbstractGregorian fast path
673+ let date2 = date. to_calendar ( Buddhist ) . to_calendar ( Gregorian ) ;
674+ // These conversions go through RataDie
675+ let date3 = date. to_calendar ( Hebrew ) . to_calendar ( Gregorian ) ;
676+ assert_eq ! ( date, date2) ;
677+ assert_eq ! ( date2, date3) ;
678+ }
668679}
You can’t perform that action at this time.
0 commit comments