From 33fd79a9f05e6d19468175ac31ae96199579d53f Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 30 Jul 2023 00:50:45 +0300 Subject: [PATCH] mu-regex: add multiline test --- lib/utils/mu-regex.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/utils/mu-regex.cc b/lib/utils/mu-regex.cc index 9ba3cc69..06028284 100644 --- a/lib/utils/mu-regex.cc +++ b/lib/utils/mu-regex.cc @@ -60,10 +60,17 @@ test_regex_match2() static void test_regex_replace() { - auto rx = Regex::make("f.o"); - assert_valid_result(rx); + { + auto rx = Regex::make("f.o"); + assert_valid_result(rx); + assert_equal(rx->replace("foobar", "cuux"), "cuuxbar"); + } - assert_equal(rx->replace("foobar", "cuux"), "cuuxbar"); + { + auto rx = Regex::make("f.o", G_REGEX_MULTILINE); + assert_valid_result(rx); + assert_equal(rx->replace("foobar\nfoobar", "cuux"), "cuuxbar\ncuuxbar"); + } } int