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

Unified Diff: source/test/intltest/regextst.cpp

Issue 822213003: ICU upgrade to 54.1 step 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: readme: better wrapping, declspec patch dropped Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/test/intltest/regextst.h ('k') | source/test/testdata/regextst.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/test/intltest/regextst.cpp
diff --git a/source/test/intltest/regextst.cpp b/source/test/intltest/regextst.cpp
index ca2fd21481a47d52695c9a36bc20a838b1f0f4ab..f440c26bf065aa4fcff726bee63cd13b4f7686b9 100644
--- a/source/test/intltest/regextst.cpp
+++ b/source/test/intltest/regextst.cpp
@@ -144,6 +144,9 @@ void RegexTest::runIndexedTest( int32_t index, UBool exec, const char* &name, ch
case 24: name = "TestBug11049";
if (exec) TestBug11049();
break;
+ case 25: name = "TestBug11371";
+ if (exec) TestBug11371();
+ break;
default: name = "";
break; //needed to end loop
}
@@ -5367,6 +5370,49 @@ void RegexTest::TestCase11049(const char *pattern, const char *data, UBool expec
}
+void RegexTest::TestBug11371() {
+ if (quick) {
+ logln("Skipping test. Runs in exhuastive mode only.");
+ return;
+ }
+ UErrorCode status = U_ZERO_ERROR;
+ UnicodeString patternString;
+
+ for (int i=0; i<8000000; i++) {
+ patternString.append(UnicodeString("()"));
+ }
+ LocalPointer<RegexPattern> compiledPat(RegexPattern::compile(patternString, 0, status));
+ if (status != U_REGEX_PATTERN_TOO_BIG) {
+ errln("File %s, line %d expected status=U_REGEX_PATTERN_TOO_BIG; got %s.",
+ __FILE__, __LINE__, u_errorName(status));
+ }
+
+ status = U_ZERO_ERROR;
+ patternString = "(";
+ for (int i=0; i<20000000; i++) {
+ patternString.append(UnicodeString("A++"));
+ }
+ patternString.append(UnicodeString("){0}B++"));
+ LocalPointer<RegexPattern> compiledPat2(RegexPattern::compile(patternString, 0, status));
+ if (status != U_REGEX_PATTERN_TOO_BIG) {
+ errln("File %s, line %d expected status=U_REGEX_PATTERN_TOO_BIG; got %s.",
+ __FILE__, __LINE__, u_errorName(status));
+ }
+
+ // Pattern with too much string data, such that string indexes overflow operand data field size
+ // in compiled instruction.
+ status = U_ZERO_ERROR;
+ patternString = "";
+ while (patternString.length() < 0x00ffffff) {
+ patternString.append(UnicodeString("stuff and things dont you know, these are a few of my favorite strings\n"));
+ }
+ patternString.append(UnicodeString("X? trailing string"));
+ LocalPointer<RegexPattern> compiledPat3(RegexPattern::compile(patternString, 0, status));
+ if (status != U_REGEX_PATTERN_TOO_BIG) {
+ errln("File %s, line %d expected status=U_REGEX_PATTERN_TOO_BIG; got %s.",
+ __FILE__, __LINE__, u_errorName(status));
+ }
+}
#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */
« no previous file with comments | « source/test/intltest/regextst.h ('k') | source/test/testdata/regextst.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698