Commit 0934803a authored by miloyip's avatar miloyip

Add Unicode regex test

parent 328b0d8a
...@@ -219,3 +219,14 @@ TEST(Regex, OneOrMore4) { ...@@ -219,3 +219,14 @@ TEST(Regex, OneOrMore4) {
EXPECT_FALSE(re.Match("")); EXPECT_FALSE(re.Match(""));
EXPECT_FALSE(re.Match("ab")); EXPECT_FALSE(re.Match("ab"));
} }
TEST(Regex, Unicode) {
#define EURO "\xE2\x82\xAC" // "\xE2\x82\xAC" is UTF-8 sequence of Euro sign U+20AC
Regex re("a" EURO "+b");
ASSERT_TRUE(re.IsValid());
EXPECT_TRUE(re.Match("a" EURO "b"));
EXPECT_TRUE(re.Match("a" EURO EURO "b"));
EXPECT_FALSE(re.Match("a?b"));
EXPECT_FALSE(re.Match("a" EURO "\xAC" "b")); // unaware of UTF-8 will match
#undef EURO
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment