From ee42c6b0ba12aad3296336bd48bcea8e9c9cb0fc Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 17 Sep 2017 20:12:46 +0900 Subject: [PATCH] Regex: add unit test to check the ".*" construct --- src/regex_impl.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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());