From a62adaefa9ae4d4ab6d2f9826865ced6aaf9f91a Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 10 Apr 2019 08:04:55 +0530 Subject: [PATCH] test: regex_ testcases (#54972) Signed-off-by: Abhijeet Kasurde --- test/integration/targets/filters/files/foo.txt | 7 ++++--- test/integration/targets/filters/templates/foo.j2 | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/test/integration/targets/filters/files/foo.txt b/test/integration/targets/filters/files/foo.txt index c024fdbf84..c8da3d9743 100644 --- a/test/integration/targets/filters/files/foo.txt +++ b/test/integration/targets/filters/files/foo.txt @@ -56,6 +56,7 @@ TODO: realpath follows symlinks. There isn't a test for this just now. TODO: add tests for set theory operations like union -TODO: add tests for regex, match, and search - - +regex_replace = bar +regex_search = 0001 +regex_findall = "['car', 'tar', 'bar']" +regex_escape = \^f\.\*o\(\.\*\)\$ diff --git a/test/integration/targets/filters/templates/foo.j2 b/test/integration/targets/filters/templates/foo.j2 index 809283dc23..010dcd0b7e 100644 --- a/test/integration/targets/filters/templates/foo.j2 +++ b/test/integration/targets/filters/templates/foo.j2 @@ -50,6 +50,7 @@ TODO: realpath follows symlinks. There isn't a test for this just now. TODO: add tests for set theory operations like union -TODO: add tests for regex, match, and search - - +regex_replace = {{ 'foo' | regex_replace('^foo', 'bar') }} +regex_search = {{ 'test_value_0001' | regex_search('([0-9]+)$')}} +regex_findall = "{{ 'car\ntar\nfoo\nbar\n' | regex_findall('^.ar$', multiline=True) }}" +regex_escape = {{ '^f.*o(.*)$' | regex_escape() }}