Mercurial > hg > nginx-tests
changeset 575:eea2b0158b51
Tests: sub filter tests for complex variable.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 14 May 2015 17:04:42 +0300 |
parents | 2cd00179f4b2 |
children | 239ade56c015 |
files | sub_filter.t |
diffstat | 1 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/sub_filter.t Thu May 14 14:46:13 2015 +0300 +++ b/sub_filter.t Thu May 14 17:04:42 2015 +0300 @@ -21,7 +21,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite sub/)->plan(22) +my $t = Test::Nginx->new()->has(qw/http rewrite sub/)->plan(25) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -78,6 +78,16 @@ sub_filter_once off; return 200 $arg_b; } + + location /var/string { + sub_filter X$arg_a _replaced; + return 200 $arg_b; + } + + location /var/replacement { + sub_filter aab '${arg_a}_replaced'; + return 200 $arg_b; + } } } @@ -116,4 +126,16 @@ like(http_get('/single/many?b=CAAC'), qr/CBBC/, 'single many middle'); like(http_get('/single/many?b=CA'), qr/CB/, 'single many end'); +TODO: { +local $TODO = 'not yet'; + +like(http_get('/var/string?a=foo&b=Xfoo'), qr/_replaced/, 'complex string'); +like(http_get('/var/string?a=abcdefghijklmnopq&b=Xabcdefghijklmnopq'), + qr/_replaced/, 'complex string long'); + +} + +like(http_get('/var/replacement?a=ee&b=aaab'), qr/aee_replaced/, + 'complex replacement'); + ###############################################################################