summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-09-17 20:12:46 +0900
committerMaxime Coste <mawww@kakoune.org>2017-11-01 14:05:14 +0800
commitee42c6b0ba12aad3296336bd48bcea8e9c9cb0fc (patch)
treef360a305f1019187ad36509478fa1b8b892e907f /src
parent4010c44fc0399f599588200c3ba051d3a84d2501 (diff)
Regex: add unit test to check the ".*" construct
Diffstat (limited to 'src')
-rw-r--r--src/regex_impl.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/regex_impl.cc b/src/regex_impl.cc
index 2c46863f..6fc513d7 100644
--- a/src/regex_impl.cc
+++ b/src/regex_impl.cc
@@ -392,6 +392,18 @@ auto test_regex = UnitTest{[]{
kak_assert(not exec.match(program, "acb"));
kak_assert(not exec.match(program, ""));
}
+
+ {
+ StringView re = "^a.*b$";
+ auto program = RegexCompiler::compile(re.begin(), re.end());
+ RegexProgram::dump(program);
+ Exec exec{program};
+ kak_assert(exec.match(program, "afoob"));
+ kak_assert(exec.match(program, "ab"));
+ kak_assert(not exec.match(program, "bab"));
+ kak_assert(not exec.match(program, ""));
+ }
+
{
StringView re = "^(foo|qux|baz)+(bar)?baz$";
auto program = RegexCompiler::compile(re.begin(), re.end());