@@ -489,26 +489,34 @@ void main() {
489
489
expect (expected.millisecond, 0 );
490
490
expect (expected.microsecond, 12 );
491
491
});
492
- });
493
492
494
- test ('with null values' , () {
495
- final initial = DateTime (2019 , 2 , 4 , 24 , 50 , 45 , 1 , 1 );
496
- final year = initial.copyWith (year: 2021 );
497
- expect (year.year, 2021 );
498
- final month = initial.copyWith (month: 10 );
499
- expect (month.month, 10 );
500
- final day = initial.copyWith (day: 28 );
501
- expect (day.day, 28 );
502
- final hour = initial.copyWith (hour: 12 );
503
- expect (hour.hour, 12 );
504
- final minute = initial.copyWith (minute: 45 );
505
- expect (minute.minute, 45 );
506
- final second = initial.copyWith (second: 10 );
507
- expect (second.second, 10 );
508
- final millisecond = initial.copyWith (millisecond: 0 );
509
- expect (millisecond.millisecond, 0 );
510
- final microsecond = initial.copyWith (microsecond: 12 );
511
- expect (microsecond.microsecond, 12 );
493
+ test ('with null values' , () {
494
+ final initial = DateTime (2019 , 2 , 4 , 24 , 50 , 45 , 1 , 1 );
495
+ final year = initial.copyWith (year: 2021 );
496
+ expect (year.year, 2021 );
497
+ final month = initial.copyWith (month: 10 );
498
+ expect (month.month, 10 );
499
+ final day = initial.copyWith (day: 28 );
500
+ expect (day.day, 28 );
501
+ final hour = initial.copyWith (hour: 12 );
502
+ expect (hour.hour, 12 );
503
+ final minute = initial.copyWith (minute: 45 );
504
+ expect (minute.minute, 45 );
505
+ final second = initial.copyWith (second: 10 );
506
+ expect (second.second, 10 );
507
+ final millisecond = initial.copyWith (millisecond: 0 );
508
+ expect (millisecond.millisecond, 0 );
509
+ final microsecond = initial.copyWith (microsecond: 12 );
510
+ expect (microsecond.microsecond, 12 );
511
+ });
512
+
513
+ test ('copyWith should save isUtc' , () async {
514
+ final now = DateTime .now ().toUtc ();
515
+ expect (now.isUtc, isTrue);
516
+
517
+ final later = now.copyWith (hour: now.hour + 3 );
518
+ expect (later.isUtc, isTrue);
519
+ });
512
520
});
513
521
});
514
522
});
0 commit comments