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

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

Issue 1544433002: Replace RE2 import with a dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-Added LICENSE and OWNERS file Created 5 years 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/regexp_test.cc ('k') | third_party/re2/re2/testing/search_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/required_prefix_test.cc
diff --git a/third_party/re2/re2/testing/required_prefix_test.cc b/third_party/re2/re2/testing/required_prefix_test.cc
deleted file mode 100644
index aed41f77874a2429884bcddede14831d874f126e..0000000000000000000000000000000000000000
--- a/third_party/re2/re2/testing/required_prefix_test.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2009 The RE2 Authors. All Rights Reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "util/test.h"
-#include "re2/regexp.h"
-
-namespace re2 {
-
-struct PrefixTest {
- const char* regexp;
- bool return_value;
- const char* prefix;
- bool foldcase;
- const char* suffix;
-};
-
-static PrefixTest tests[] = {
- // If the regexp is missing a ^, there's no required prefix.
- { "abc", false },
- { "", false },
- { "(?m)^", false },
-
- // If the regexp immediately goes into
- // something not a literal match, there's no required prefix.
- { "^(abc)", false },
- { "^a*", false },
-
- // Otherwise, it should work.
- { "^abc$", true, "abc", false, "(?-m:$)" },
- { "^abc", true, "abc", false, "" },
- { "^(?i)abc", true, "abc", true, "" },
- { "^abcd*", true, "abc", false, "d*" },
- { "^[Aa][Bb]cd*", true, "ab", true, "cd*" },
- { "^ab[Cc]d*", true, "ab", false, "[Cc]d*" },
- { "^☺abc", true, "☺abc", false, "" },
-};
-
-TEST(RequiredPrefix, SimpleTests) {
- for (int i = 0; i < arraysize(tests); i++) {
- const PrefixTest& t = tests[i];
- for (int j = 0; j < 2; j++) {
- Regexp::ParseFlags flags = Regexp::LikePerl;
- if (j == 0)
- flags = flags | Regexp::Latin1;
- Regexp* re = Regexp::Parse(t.regexp, flags, NULL);
- CHECK(re) << " " << t.regexp;
- string p;
- bool f = false;
- Regexp* s = NULL;
- CHECK_EQ(t.return_value, re->RequiredPrefix(&p, &f, &s))
- << " " << t.regexp << " " << (j==0 ? "latin1" : "utf") << " " << re->Dump();
- if (t.return_value) {
- CHECK_EQ(p, string(t.prefix))
- << " " << t.regexp << " " << (j==0 ? "latin1" : "utf");
- CHECK_EQ(f, t.foldcase)
- << " " << t.regexp << " " << (j==0 ? "latin1" : "utf");
- CHECK_EQ(s->ToString(), string(t.suffix))
- << " " << t.regexp << " " << (j==0 ? "latin1" : "utf");
- s->Decref();
- }
- re->Decref();
- }
- }
-}
-
-} // namespace re2
« no previous file with comments | « third_party/re2/re2/testing/regexp_test.cc ('k') | third_party/re2/re2/testing/search_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698