diff --git a/engine/googletest_list.cpp b/engine/googletest_list.cpp index f56d8701..196413bc 100644 --- a/engine/googletest_list.cpp +++ b/engine/googletest_list.cpp @@ -51,24 +51,23 @@ const std::string name_expr = "([[:alpha:][:digit:]_]+[[:alpha:][:digit:]_/]*)"; /// The separator between a test suite and a test case. const std::string testsuite_testcase_separator = "."; -/// A complete regular expression representing a line with a test suite -/// definition, e,g., -/// * "TestSuite." -/// * "TestSuite/Prefix.", or -/// * "TestSuite/Prefix. # TypeParam = .+" -const std::string testsuite_expr = - name_expr + "\\.([[:space:]]+# TypeParam = .+)?"; - /// A complete regular expression representing a line with a test case /// definition, e,g., /// * " TestCase" /// * " TestCase/0" /// * " TestCase/0 # GetParam() = 4" -const std::string testcase_expr = - " " + name_expr + "([[:space:]]+# GetParam\\(\\) = .+)?"; +const std::regex testcase_re( + " " + name_expr + "([[:space:]]+# GetParam\\(\\) = .+)?" +); -const std::regex testcase_re(testcase_expr); -const std::regex testsuite_re(testsuite_expr); +/// A complete regular expression representing a line with a test suite +/// definition, e,g., +/// * "TestSuite." +/// * "TestSuite/Prefix.", or +/// * "TestSuite/Prefix. # TypeParam = .+" +const std::regex testsuite_re( + name_expr + "\\.([[:space:]]+# TypeParam = .+)?" +); } // anonymous namespace diff --git a/engine/googletest_result.cpp b/engine/googletest_result.cpp index e1bb3297..ea02d80a 100644 --- a/engine/googletest_result.cpp +++ b/engine/googletest_result.cpp @@ -53,12 +53,23 @@ using utils::optional; namespace { +/// Internal string for specifying invalid output. const std::string invalid_output_message = "invalid output"; -const std::regex disabled_re(R"RE((YOU HAVE [[:digit:]]+ DISABLED TESTS?))RE"); + +/// Regular expression for disabled tests line. +const std::regex disabled_re( + R"RE((YOU HAVE [[:digit:]]+ DISABLED TESTS?))RE" +); + +/// Regular expression for starting sentinel of results block. const std::regex starting_sentinel_re( - R"(\[[[:space:]]+RUN[[:space:]]+\][[:space:]]+[A-Za-z0-9]+\.[A-Za-z0-9]+)"); + R"(\[[[:space:]]+RUN[[:space:]]+\][[:space:]]+[A-Za-z0-9]+\.[A-Za-z0-9]+)" +); + +/// Regular expression for ending sentinel of results block. const std::regex ending_sentinel_re( - R"RE(\[[[:space:]]+(FAILED|OK|SKIPPED)[[:space:]]+\])RE"); + R"RE(\[[[:space:]]+(FAILED|OK|SKIPPED)[[:space:]]+\])RE" +); /// Parses a test result that does not accept a reason. ///