[PATCH] Tests: added tests for relative file names in "if"

Maxim Dounin mdounin at mdounin.ru
Mon May 25 01:13:52 UTC 2026


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1779658309 -10800
#      Mon May 25 00:31:49 2026 +0300
# Node ID b9f33520b42cafbd084483f88a1fc9fb513592a9
# Parent  48645a6fd3936888837abcc3e0edc3a2e65047ca
Tests: added tests for relative file names in "if".

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