Skip to content

Commit

Permalink
filterx: light tests for regexp_subst match group feature
Browse files Browse the repository at this point in the history
Signed-off-by: shifter <shifter@axoflow.com>
  • Loading branch information
bshifter committed Nov 29, 2024
1 parent 61263a9 commit f3bf76b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/light/functional_tests/filterx/test_filterx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit f3bf76b

Please sign in to comment.