# HG changeset patch # User Maxim Dounin # Date 1379382774 -14400 # Node ID 433be52171d57c3fd143ffb394d98f718fa384fa # Parent c0bd624db0672ad68a3669a301f2df2faa5a1cd9 Tests: more location matching tests. diff --git a/http_location.t b/http_location.t --- a/http_location.t +++ b/http_location.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(10) +my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(14) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -63,6 +63,26 @@ http { return 204; } + location = /foo { + add_header X-Location "/foo exact"; + return 204; + } + + location /foo { + add_header X-Location "/foo prefix"; + return 204; + } + + location = /foo/ { + add_header X-Location "/foo/ exact"; + return 204; + } + + location /foo/ { + add_header X-Location "/foo/ prefix"; + return 204; + } + location /lowercase { add_header X-Location lowercase; return 204; @@ -89,6 +109,11 @@ like(http_get('/t.GIF'), qr/X-Location: like(http_get('/casefull/t.gif'), qr/X-Location: regex/, 'first regex wins'); like(http_get('/casefull/'), qr/X-Location: casefull/, 'casefull regex'); +like(http_get('/foo'), qr!X-Location: /foo exact!, '/foo exact'); +like(http_get('/foobar'), qr!X-Location: /foo prefix!, '/foo prefix'); +like(http_get('/foo/'), qr!X-Location: /foo/ exact!, '/foo/ exact'); +like(http_get('/foo/bar'), qr!X-Location: /foo/ prefix!, '/foo/ prefix'); + SKIP: { skip 'caseless os', 1 if $^O eq 'MSWin32' or $^O eq 'darwin';