File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ class TestNSDateFormatter: XCTestCase {
27
27
( " test_dateStyleMedium " , test_dateStyleMedium) ,
28
28
( " test_dateStyleLong " , test_dateStyleLong) ,
29
29
( " test_dateStyleFull " , test_dateStyleFull) ,
30
- ( " test_customDateFormat " , test_customDateFormat)
30
+ ( " test_customDateFormat " , test_customDateFormat) ,
31
+ ( " test_setLocalizedDateFormatFromTemplate " , test_setLocalizedDateFormatFromTemplate) ,
31
32
]
32
33
}
33
34
@@ -277,5 +278,17 @@ class TestNSDateFormatter: XCTestCase {
277
278
XCTAssertEqual ( f. string ( from: testDate) , " 11-03-2016 " )
278
279
279
280
}
280
-
281
+
282
+ func test_setLocalizedDateFormatFromTemplate( ) {
283
+ let locale = Locale ( identifier: DEFAULT_LOCALE)
284
+ let template = " EEEE MMMM d y hhmmss a zzzz "
285
+
286
+ let f = DateFormatter ( )
287
+ f. locale = locale
288
+ f. setLocalizedDateFormatFromTemplate ( template)
289
+
290
+ let dateFormat = DateFormatter . dateFormat ( fromTemplate: template, options: 0 , locale: locale)
291
+ XCTAssertEqual ( f. dateFormat, dateFormat)
292
+ }
293
+
281
294
}
You can’t perform that action at this time.
0 commit comments