@@ -24,6 +24,7 @@ class TestNSCalendar: XCTestCase {
24
24
( " test_gettingDatesOnHebrewCalendar " , test_gettingDatesOnHebrewCalendar ) ,
25
25
( " test_initializingWithInvalidIdentifier " , test_initializingWithInvalidIdentifier) ,
26
26
( " test_gettingDatesOnChineseCalendar " , test_gettingDatesOnChineseCalendar) ,
27
+ ( " test_copy " , test_copy) ,
27
28
// Disabled because this fails on linux https://bugs.swift.org/browse/SR-320
28
29
// ("test_currentCalendarRRstability", test_currentCalendarRRstability),
29
30
]
@@ -88,4 +89,19 @@ class TestNSCalendar: XCTestCase {
88
89
89
90
XCTAssertEqual ( AMSymbols . count, 10 , " Accessing current calendar should work over multiple callouts " )
90
91
}
92
+
93
+ func test_copy( ) {
94
+ let calendar = Calendar . currentCalendar ( )
95
+
96
+ //Mutate below fields and check if change is being reflected in copy.
97
+ calendar. firstWeekday = 2
98
+ calendar. minimumDaysInFirstWeek = 2
99
+
100
+ let copy = calendar. copy ( ) as! Calendar
101
+ XCTAssertTrue ( copy. isEqual ( calendar) )
102
+
103
+ //verify firstWeekday and minimumDaysInFirstWeek of 'copy'.
104
+ XCTAssertEqual ( copy. firstWeekday, 2 )
105
+ XCTAssertEqual ( copy. minimumDaysInFirstWeek, 2 )
106
+ }
91
107
}
0 commit comments