changeset 635:bc91b86a71ee

Tests: added test for try_files in regex location with alias. It was broken by c985d90a8d1f.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 27 Jul 2015 13:01:41 +0300
parents 40675bfad7d3
children 1925b27f24b6
files http_try_files.t
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/http_try_files.t
+++ b/http_try_files.t
@@ -21,7 +21,7 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(8)
+my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(9)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -66,6 +66,11 @@ http {
             try_files /directory =404;
         }
 
+        location ~ /alias_re.html {
+            alias %%TESTDIR%%/directory;
+            try_files $uri =404;
+        }
+
         location /fallback {
             proxy_pass http://127.0.0.1:8081/fallback;
         }
@@ -88,6 +93,7 @@ http {
 EOF
 
 mkdir($t->testdir() . '/directory');
+$t->write_file('directory/alias_re.html', 'SEE THIS');
 $t->write_file('found.html', 'SEE THIS');
 $t->run();
 
@@ -103,4 +109,11 @@ like(http_get('/file-dir/'), qr!404 Not!
 like(http_get('/dir-dir/'), qr!301 Moved Permanently!, 'dir matches dir');
 like(http_get('/dir-file/'), qr!404 Not!, 'dir does not match file');
 
+SKIP: {
+skip 'leaves coredump', 1 unless $ENV{TEST_NGINX_UNSAFE};
+
+like(http_get('/alias_re.html'), qr!SEE THIS!, 'alias in regex location');
+
+}
+
 ###############################################################################