Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(338)

Side by Side Diff: source/test/intltest/dtfmttst.cpp

Issue 279780043: ticket:11985: Handle 'j' and 'J' in date time pattern skeletons. (Closed) Base URL: svn+ssh://source.icu-project.org/repos/icu/icu/trunk
Patch Set: Updated unit tests. Created 9 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/test/intltest/dtfmttst.h ('k') | source/test/intltest/dtifmtts.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /******************************************************************** 1 /********************************************************************
2 * COPYRIGHT: 2 * COPYRIGHT:
3 * Copyright (c) 1997-2015, International Business Machines 3 * Copyright (c) 1997-2015, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************/ 5 ********************************************************************/
6 6
7 #include "unicode/utypes.h" 7 #include "unicode/utypes.h"
8 8
9 #if !UCONFIG_NO_FORMATTING 9 #if !UCONFIG_NO_FORMATTING
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 TESTCASE_AUTO(TestParseLeniencyAPIs); 107 TESTCASE_AUTO(TestParseLeniencyAPIs);
108 TESTCASE_AUTO(TestNumberFormatOverride); 108 TESTCASE_AUTO(TestNumberFormatOverride);
109 TESTCASE_AUTO(TestCreateInstanceForSkeleton); 109 TESTCASE_AUTO(TestCreateInstanceForSkeleton);
110 TESTCASE_AUTO(TestCreateInstanceForSkeletonDefault); 110 TESTCASE_AUTO(TestCreateInstanceForSkeletonDefault);
111 TESTCASE_AUTO(TestCreateInstanceForSkeletonWithCalendar); 111 TESTCASE_AUTO(TestCreateInstanceForSkeletonWithCalendar);
112 TESTCASE_AUTO(TestDFSCreateForLocaleNonGregorianLocale); 112 TESTCASE_AUTO(TestDFSCreateForLocaleNonGregorianLocale);
113 TESTCASE_AUTO(TestDFSCreateForLocaleWithCalendarInLocale); 113 TESTCASE_AUTO(TestDFSCreateForLocaleWithCalendarInLocale);
114 TESTCASE_AUTO(TestChangeCalendar); 114 TESTCASE_AUTO(TestChangeCalendar);
115 115
116 TESTCASE_AUTO(TestPatternFromSkeleton);
117
116 TESTCASE_AUTO_END; 118 TESTCASE_AUTO_END;
117 } 119 }
118 120
119 void DateFormatTest::TestPatterns() { 121 void DateFormatTest::TestPatterns() {
120 static const struct { 122 static const struct {
121 const char *actualPattern; 123 const char *actualPattern;
122 const char *expectedPattern; 124 const char *expectedPattern;
123 const char *localeID; 125 const char *localeID;
124 const char *expectedLocalPattern; 126 const char *expectedLocalPattern;
125 } EXPECTED[] = { 127 } EXPECTED[] = {
(...skipping 4702 matching lines...) Expand 10 before | Expand all | Expand 10 after
4828 fmt->adoptCalendar(Calendar::createInstance(en_heb, status)); 4830 fmt->adoptCalendar(Calendar::createInstance(en_heb, status));
4829 if (!assertSuccess("", status)) { 4831 if (!assertSuccess("", status)) {
4830 return; 4832 return;
4831 } 4833 }
4832 UnicodeString result; 4834 UnicodeString result;
4833 FieldPosition pos(0); 4835 FieldPosition pos(0);
4834 fmt->format(date(98, 5-1, 25), result, pos); 4836 fmt->format(date(98, 5-1, 25), result, pos);
4835 assertEquals("format yMMMd", "Iyar 29, 5758", result); 4837 assertEquals("format yMMMd", "Iyar 29, 5758", result);
4836 } 4838 }
4837 4839
4840 void DateFormatTest::TestPatternFromSkeleton() {
4841 static const struct {
4842 const Locale& locale;
4843 const char* const skeleton;
4844 const char* const pattern;
4845 } TESTDATA[] = {
4846 // Ticket #11985
4847 {Locale::getEnglish(), "jmm", "h:mm a"},
roubert (google) 2015/11/17 21:34:17 These test cases pass just like this before change
4848 {Locale::getEnglish(), "Jmm", "hh:mm"},
mark.edward.davis 2015/11/18 12:15:29 Make these jj and JJ to reduce dependency on chang
roubert (google) 2015/11/18 12:28:39 Done.
4849 {Locale::getGerman(), "jmm", "HH:mm"},
4850 {Locale::getGerman(), "Jmm", "HH:mm"},
4851 };
4852
4853 for (size_t i = 0; i < sizeof TESTDATA / sizeof *TESTDATA; i++) {
4854 UErrorCode status = U_ZERO_ERROR;
4855 LocalPointer<DateFormat> fmt(
4856 DateFormat::createInstanceForSkeleton(
4857 TESTDATA[i].skeleton, TESTDATA[i].locale, status));
4858 if (!assertSuccess("createInstanceForSkeleton", status)) {
4859 return;
4860 }
4861 UnicodeString pattern;
4862 static_cast<const SimpleDateFormat*>(fmt.getAlias())->toPattern(pattern) ;
4863 assertEquals("Format pattern", TESTDATA[i].pattern, pattern);
4864 }
4865 }
4866
4838 4867
4839 #endif /* #if !UCONFIG_NO_FORMATTING */ 4868 #endif /* #if !UCONFIG_NO_FORMATTING */
4840 4869
4841 //eof 4870 //eof
OLDNEW
« no previous file with comments | « source/test/intltest/dtfmttst.h ('k') | source/test/intltest/dtifmtts.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b