Home | History | Annotate | Download | only in Support

Lines Matching refs:Regex

1 //===- llvm/unittest/Support/RegexTest.cpp - Regex tests --===//
10 #include "llvm/Support/Regex.h"
22 Regex r1("^[0-9]+$");
28 Regex r2("[0-9]+");
33 Regex r3("[0-9]+([a-f])?:([0-9]+)");
46 Regex r4("a[^b]+b");
57 Regex r5(NulPattern);
65 Regex r1("([a-z]+)_\\1");
71 Regex r2("a([0-9])b\\1c\\1");
77 Regex r3("a([0-9])([a-z])b\\1\\2");
89 EXPECT_EQ("aNUMber", Regex("[0-9]+").sub("NUM", "a1234ber"));
92 EXPECT_EQ("a\\ber", Regex("[0-9]+").sub("\\\\", "a1234ber", &Error));
94 EXPECT_EQ("a\nber", Regex("[0-9]+").sub("\\n", "a1234ber", &Error));
96 EXPECT_EQ("a\tber", Regex("[0-9]+").sub("\\t", "a1234ber", &Error));
98 EXPECT_EQ("ajber", Regex("[0-9]+").sub("\\j", "a1234ber", &Error));
101 EXPECT_EQ("aber", Regex("[0-9]+").sub("\\", "a1234ber", &Error));
105 EXPECT_EQ("aa1234bber", Regex("a[0-9]+b").sub("a\\0b", "a1234ber", &Error));
108 EXPECT_EQ("a1234ber", Regex("a([0-9]+)b").sub("a\\1b", "a1234ber", &Error));
111 EXPECT_EQ("aber", Regex("a[0-9]+b").sub("a\\100b", "a1234ber", &Error));
116 EXPECT_TRUE(Regex::isLiteralERE("abc"));
117 EXPECT_FALSE(Regex::isLiteralERE("a(bc)"));
118 EXPECT_FALSE(Regex::isLiteralERE("^abc"));
119 EXPECT_FALSE(Regex::isLiteralERE("abc$"));
120 EXPECT_FALSE(Regex::isLiteralERE("a|bc"));
121 EXPECT_FALSE(Regex::isLiteralERE("abc*"));
122 EXPECT_FALSE(Regex::isLiteralERE("abc+"));
123 EXPECT_FALSE(Regex::isLiteralERE("abc?"));
124 EXPECT_FALSE(Regex::isLiteralERE("abc."));
125 EXPECT_FALSE(Regex::isLiteralERE("a[bc]"));
126 EXPECT_FALSE(Regex::isLiteralERE("abc\\1"));
127 EXPECT_FALSE(Regex::isLiteralERE("abc{1,2}"));