Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

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

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/test/intltest/dcfmapts.cpp ('k') | source/test/intltest/dtfmtrtts.cpp » ('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-2014, International Business Machines Corporation and 3 * Copyright (c) 1997-2015, International Business Machines Corporation and
4 * others. All Rights Reserved. 4 * 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 #include "dtfmrgts.h" 10 #include "dtfmrgts.h"
11 11
12 #include "unicode/timezone.h" 12 #include "unicode/timezone.h"
13 #include "unicode/gregocal.h" 13 #include "unicode/gregocal.h"
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 1524
1525 if (cal->get(UCAL_DAY_OF_MONTH, status) != expectedDay) { 1525 if (cal->get(UCAL_DAY_OF_MONTH, status) != expectedDay) {
1526 errln("Parsing failed: day of month should be '7' with pattern: \"" + pa ttern + "\" for text: \"" + text + "\""); 1526 errln("Parsing failed: day of month should be '7' with pattern: \"" + pa ttern + "\" for text: \"" + text + "\"");
1527 } 1527 }
1528 1528
1529 delete cal; 1529 delete cal;
1530 } 1530 }
1531 1531
1532 void DateFormatRegressionTest::TestT10334(void) { 1532 void DateFormatRegressionTest::TestT10334(void) {
1533 UErrorCode status = U_ZERO_ERROR; 1533 UErrorCode status = U_ZERO_ERROR;
1534 UnicodeString pattern("--: EEE-WW-MMMM-yyyy"); 1534 UnicodeString pattern("'--: 'EEE-WW-MMMM-yyyy");
1535 UnicodeString text("--mon-02-march-2011"); 1535 UnicodeString text("--mon-02-march-2011");
1536 SimpleDateFormat format(pattern, status); 1536 SimpleDateFormat format(pattern, status);
1537 1537
1538 logln("pattern["+pattern+"] text["+text+"]"); 1538 logln("pattern["+pattern+"] text["+text+"]");
1539 1539
1540 if (U_FAILURE(status)) { 1540 if (U_FAILURE(status)) {
1541 dataerrln("Fail creating SimpleDateFormat object - %s", u_errorName(stat us)); 1541 dataerrln("Fail creating SimpleDateFormat object - %s", u_errorName(stat us));
1542 return; 1542 return;
1543 } 1543 }
1544 1544
1545 format.setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, FALSE, status); 1545 format.setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, FALSE, status);
1546 format.parse(text, status); 1546 format.parse(text, status);
1547 if (!U_FAILURE(status)) { 1547 if (!U_FAILURE(status)) {
1548 errln("parse partial match did NOT fail in strict mode - %s", u_errorNam e(status)); 1548 errln("parse partial match did NOT fail in strict mode - %s", u_errorNam e(status));
1549 } 1549 }
1550 1550
1551 status = U_ZERO_ERROR; 1551 status = U_ZERO_ERROR;
1552 format.setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, TRUE, status); 1552 format.setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, TRUE, status);
1553 format.parse(text, status); 1553 format.parse(text, status);
1554 if (U_FAILURE(status)) { 1554 if (U_FAILURE(status)) {
1555 errln("parse partial match failure in lenient mode - %s", u_errorName(st atus)); 1555 errln("parse partial match failure in lenient mode - %s", u_errorName(st atus));
1556 } 1556 }
1557 1557
1558 status = U_ZERO_ERROR; 1558 status = U_ZERO_ERROR;
1559 pattern = UnicodeString("YYYY MM dd"); 1559 pattern = UnicodeString("YYYY MM dd");
1560 text = UnicodeString("2013 12 10"); 1560 text = UnicodeString("2013 12 10");
1561 format.applyPattern(pattern); 1561 format.applyPattern(pattern);
1562 UDate referenceDate = format.parse(text, status); 1562 UDate referenceDate = format.parse(text, status);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 ParsePosition pos(0); 1629 ParsePosition pos(0);
1630 SimpleDateFormat * sdmft = new SimpleDateFormat(itemPtr->pattern, lo cale, status); 1630 SimpleDateFormat * sdmft = new SimpleDateFormat(itemPtr->pattern, lo cale, status);
1631 if (U_FAILURE(status)) { 1631 if (U_FAILURE(status)) {
1632 dataerrln("Unable to create SimpleDateFormat - %s", u_errorName( status)); 1632 dataerrln("Unable to create SimpleDateFormat - %s", u_errorName( status));
1633 continue; 1633 continue;
1634 } 1634 }
1635 logln("parsing " + itemPtr->parseString); 1635 logln("parsing " + itemPtr->parseString);
1636 sdmft->setLenient(itemPtr->leniency); 1636 sdmft->setLenient(itemPtr->leniency);
1637 sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->len iency, status); 1637 sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->len iency, status);
1638 sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->lenien cy, status); 1638 sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->lenien cy, status);
1639 sdmft->setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, itemPtr->lenien cy, status); 1639 sdmft->setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, itemPtr ->leniency, status);
1640 sdmft->parse(itemPtr->parseString, pos); 1640 sdmft->parse(itemPtr->parseString, pos);
1641 1641
1642 delete sdmft; 1642 delete sdmft;
1643 if(pos.getErrorIndex() > -1) { 1643 if(pos.getErrorIndex() > -1) {
1644 if(itemPtr->expectedResult.length() != 0) { 1644 if(itemPtr->expectedResult.length() != 0) {
1645 errln("error: unexpected error - " + itemPtr->parseString + " - error index " + pos.getErrorIndex() + 1645 errln("error: unexpected error - " + itemPtr->parseString + " - error index " + pos.getErrorIndex() +
1646 " - leniency " + itemPtr->leniency); 1646 " - leniency " + itemPtr->leniency);
1647 continue; 1647 continue;
1648 } else { 1648 } else {
1649 continue; 1649 continue;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 format.parse(text, pp); 1717 format.parse(text, pp);
1718 errorIdx = pp.getErrorIndex(); 1718 errorIdx = pp.getErrorIndex();
1719 if (errorIdx == -1) { 1719 if (errorIdx == -1) {
1720 errln("failed to report invalid (negative) starting parse position"); 1720 errln("failed to report invalid (negative) starting parse position");
1721 } 1721 }
1722 } 1722 }
1723 1723
1724 #endif /* #if !UCONFIG_NO_FORMATTING */ 1724 #endif /* #if !UCONFIG_NO_FORMATTING */
1725 1725
1726 //eof 1726 //eof
OLDNEW
« no previous file with comments | « source/test/intltest/dcfmapts.cpp ('k') | source/test/intltest/dtfmtrtts.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698