From f3bf76bb60146c9d00d8f3cd3117e580b5ea765b Mon Sep 17 00:00:00 2001 From: shifter Date: Wed, 27 Nov 2024 03:00:08 +0100 Subject: [PATCH] filterx: light tests for regexp_subst match group feature Signed-off-by: shifter --- tests/light/functional_tests/filterx/test_filterx.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/light/functional_tests/filterx/test_filterx.py b/tests/light/functional_tests/filterx/test_filterx.py index 53f521f3b..e65b3ae13 100644 --- a/tests/light/functional_tests/filterx/test_filterx.py +++ b/tests/light/functional_tests/filterx/test_filterx.py @@ -1938,6 +1938,9 @@ def test_regexp_subst(config, syslog_ng): $MSG.orgrp_global = regexp_subst("foobarbaz", "(fo|az)", "!", global=true); $MSG.ignore_case_control = regexp_subst("FoObArBaz", "(o|a)", "!", global=true); $MSG.ignore_case = regexp_subst("FoObArBaz", "(o|a)", "!", ignorecase=true, global=true); + $MSG.groups_off = regexp_subst("25-02-2022", /(\d{2})-(\d{2})-(\d{4})/, "\\3-\\2-\\1");; + $MSG.groups_on = regexp_subst("25-02-2022", /(\d{2})-(\d{2})-(\d{4})/, "\\3-\\2-\\1", groups=true); + $MSG.mixed_grps = regexp_subst("25-02-2022", /(\d{2})-(\d{2})-(\d{4})/, "foo:\\3-\\2-\\1:bar:baz", groups=true); """, ) syslog_ng.start(config) @@ -1956,7 +1959,10 @@ def test_regexp_subst(config, syslog_ng): r""""zero_length_match_global":"!f!o!o!b!a!r!b!a!z!",""" r""""orgrp_global":"!obarb!",""" r""""ignore_case_control":"F!ObArB!z",""" - r""""ignore_case":"F!!b!rB!z"}""" + "\n" + r""""ignore_case":"F!!b!rB!z",""" + r""""groups_off":"\\3-\\2-\\1",""" + r""""groups_on":"2022-02-25",""" + r""""mixed_grps":"foo:2022-02-25:bar:baz"}""" + "\n" ) assert file_true.read_log() == exp