Parse '.' in regexes
This commit is contained in:
parent
52c338ed60
commit
c2abfd2d03
5 changed files with 25 additions and 10 deletions
|
|
@ -6,7 +6,7 @@ using namespace rules;
|
|||
|
||||
START_TEST
|
||||
|
||||
describe("parsing pattern rules", []() {
|
||||
describe("parsing regex pattern rules", []() {
|
||||
it("parses simple strings", [&]() {
|
||||
Pattern rule("abc");
|
||||
AssertThat(
|
||||
|
|
@ -17,6 +17,13 @@ describe("parsing pattern rules", []() {
|
|||
character({ 'c' })
|
||||
})));
|
||||
});
|
||||
|
||||
it("parses wildcard '.' characters", [&]() {
|
||||
Pattern rule(".");
|
||||
AssertThat(
|
||||
rule.to_rule_tree(),
|
||||
EqualsPointer(CharacterSet({'\n'}).complement().copy()));
|
||||
});
|
||||
|
||||
it("parses character classes", []() {
|
||||
Pattern rule("\\w-\\d");
|
||||
|
|
@ -114,6 +121,15 @@ describe("parsing pattern rules", []() {
|
|||
character({ '(' }),
|
||||
character({ 'b' })
|
||||
})));
|
||||
|
||||
Pattern rule2("a\\.");
|
||||
AssertThat(
|
||||
rule2.to_rule_tree(),
|
||||
EqualsPointer(seq({
|
||||
character({ 'a' }),
|
||||
character({ '.' }),
|
||||
})));
|
||||
|
||||
});
|
||||
|
||||
it("parses repeating rules", []() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue