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

Unified Diff: third_party/re2/re2/testing/re2_test.cc

Issue 10873029: Migrate WebRequestRedirectByRegExAction to use RE2 and roll RE2 to revision 97:401ab4168e8e (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 years, 4 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 | « third_party/re2/re2/testing/re2_arg_test.cc ('k') | third_party/re2/re2/testing/set_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/testing/re2_test.cc
diff --git a/third_party/re2/re2/testing/re2_test.cc b/third_party/re2/re2/testing/re2_test.cc
index ef5d4aab53528b7155ad64c386462df411a3f9d4..911e8689ed5e28c78fe6cb228721570dee037ba0 100644
--- a/third_party/re2/re2/testing/re2_test.cc
+++ b/third_party/re2/re2/testing/re2_test.cc
@@ -757,18 +757,18 @@ TEST(RE2, FullMatchTypeTests) {
CHECK(RE2::FullMatch("100", "(-?\\d+)", &v)); CHECK_EQ(v, 100);
CHECK(RE2::FullMatch("-100", "(-?\\d+)", &v)); CHECK_EQ(v, -100);
- snprintf(buf, sizeof(buf), "%lld", max);
+ snprintf(buf, sizeof(buf), "%lld", (long long int)max);
CHECK(RE2::FullMatch(buf, "(-?\\d+)", &v)); CHECK_EQ(v, max);
- snprintf(buf, sizeof(buf), "%lld", min);
+ snprintf(buf, sizeof(buf), "%lld", (long long int)min);
CHECK(RE2::FullMatch(buf, "(-?\\d+)", &v)); CHECK_EQ(v, min);
- snprintf(buf, sizeof(buf), "%lld", max);
+ snprintf(buf, sizeof(buf), "%lld", (long long int)max);
assert(buf[strlen(buf)-1] != '9');
buf[strlen(buf)-1]++;
CHECK(!RE2::FullMatch(buf, "(-?\\d+)", &v));
- snprintf(buf, sizeof(buf), "%lld", min);
+ snprintf(buf, sizeof(buf), "%lld", (long long int)min);
assert(buf[strlen(buf)-1] != '9');
buf[strlen(buf)-1]++;
CHECK(!RE2::FullMatch(buf, "(-?\\d+)", &v));
@@ -782,7 +782,7 @@ TEST(RE2, FullMatchTypeTests) {
CHECK(RE2::FullMatch("100", "(-?\\d+)", &v)); CHECK_EQ(v, 100);
CHECK(RE2::FullMatch("-100", "(-?\\d+)", &v2)); CHECK_EQ(v2, -100);
- snprintf(buf, sizeof(buf), "%llu", max);
+ snprintf(buf, sizeof(buf), "%llu", (long long unsigned)max);
CHECK(RE2::FullMatch(buf, "(-?\\d+)", &v)); CHECK_EQ(v, max);
assert(buf[strlen(buf)-1] != '9');
@@ -1253,6 +1253,14 @@ TEST(RE2, NeverNewline) {
}
}
+// Check that there are no capturing groups in "never capture" mode.
+TEST(RE2, NeverCapture) {
+ RE2::Options opt;
+ opt.set_never_capture(true);
+ RE2 re("(r)(e)", opt);
+ EXPECT_EQ(0, re.NumberOfCapturingGroups());
+}
+
// Bitstate bug was looking at submatch[0] even if nsubmatch == 0.
// Triggered by a failed DFA search falling back to Bitstate when
// using Match with a NULL submatch set. Bitstate tried to read
« no previous file with comments | « third_party/re2/re2/testing/re2_arg_test.cc ('k') | third_party/re2/re2/testing/set_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698