[nginx-tests] Tests: added tests for relative file names in "if".
Maxim Dounin
mdounin at mdounin.ru
Tue May 26 01:00:53 UTC 2026
details: http://freenginx.org/hg/nginx-tests/rev/2ca1dd5671e6
branches:
changeset: 2062:2ca1dd5671e6
user: Maxim Dounin <mdounin at mdounin.ru>
date: Tue May 26 03:23:22 2026 +0300
description:
Tests: added tests for relative file names in "if".
diffstat:
rewrite_if.t | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diffs (44 lines):
diff --git a/rewrite_if.t b/rewrite_if.t
--- a/rewrite_if.t
+++ b/rewrite_if.t
@@ -22,7 +22,7 @@ use Test::Nginx;
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(33)
+my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(35)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
@@ -134,6 +134,18 @@ http {
return 204;
}
}
+
+ location /relative {
+ if (-f file) {
+ return 204;
+ }
+ }
+
+ location /relative_var {
+ if (-f $arg_c) {
+ return 204;
+ }
+ }
}
}
@@ -192,4 +204,12 @@ unlike(http_get('/not_exec?c=dir'), qr/
}
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.31.2');
+
+like(http_get('/relative'), qr/ 204 /, 'relative file name');
+like(http_get('/relative_var?c=file'), qr/ 204 /, 'relative file name var');
+
+}
+
###############################################################################
More information about the nginx-devel
mailing list