[PATCH] Tests: another test with variables which change between accesses
Maxim Dounin
mdounin at mdounin.ru
Sat Jul 18 21:24:38 UTC 2026
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1784409820 -10800
# Sun Jul 19 00:23:40 2026 +0300
# Node ID 1d795d140c1829c9a3db45a87069760ff6914afe
# Parent bd857e1a45f8b14c01c3091ec4dc7f4c6ddad707
Tests: another test with variables which change between accesses.
A test with "return" and map with side effects added, which covers
ngx_http_complex_value() usage.
diff --git a/rewrite.t b/rewrite.t
--- a/rewrite.t
+++ b/rewrite.t
@@ -21,7 +21,7 @@ use Test::Nginx;
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(26)
+my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(27)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
@@ -150,6 +150,10 @@ http {
rewrite ^ $capture$map_capture redirect;
}
+ location /map_return/ {
+ return 200 $capture$map_capture;
+ }
+
location /break {
rewrite ^ /return200;
break;
@@ -283,7 +287,7 @@ like(http_get('/capture_nested/%25?a=b')
}
TODO: {
-todo_skip 'might coredump', 1
+todo_skip 'might coredump', 2
unless $t->has_version('1.31.3')
or $ENV{TEST_NGINX_UNSAFE};
local $TODO = 'not yet', $t->todo_alerts();
@@ -291,6 +295,9 @@ local $TODO = 'not yet', $t->todo_alerts
like(http_get('/map/test-long-uri'), qr!Location: .*/map/test-long-uri!ms,
'rewrite and map with side effects');
+like(http_get('/map_return/test-long-uri'), qr!.*/map_return/test-long-uri!,
+ 'return and map with side effects');
+
}
# break
More information about the nginx-devel
mailing list