Skip to content

Commit 3a827f4

Browse files
committed
Add test case
1 parent 73b8d2f commit 3a827f4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

TestFoundation/TestNSDateFormatter.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class TestNSDateFormatter: XCTestCase {
2727
("test_dateStyleMedium", test_dateStyleMedium),
2828
("test_dateStyleLong", test_dateStyleLong),
2929
("test_dateStyleFull", test_dateStyleFull),
30-
("test_customDateFormat", test_customDateFormat)
30+
("test_customDateFormat", test_customDateFormat),
31+
("test_setLocalizedDateFormatFromTemplate", test_setLocalizedDateFormatFromTemplate),
3132
]
3233
}
3334

@@ -277,5 +278,17 @@ class TestNSDateFormatter: XCTestCase {
277278
XCTAssertEqual(f.string(from: testDate), "11-03-2016")
278279

279280
}
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+
281294
}

0 commit comments

Comments
 (0)