Mercurial > hg > nginx-tests
comparison index2.t @ 1265:200d9d091da2
Tests: index tests for configuration token starting with variable.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 21 Dec 2017 16:48:22 +0300 |
parents | index.t@882267679006 |
children | 97c8280de681 |
comparison
equal
deleted
inserted
replaced
1264:eb727c5ccef6 | 1265:200d9d091da2 |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Sergey Kandaurov | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for index module, which is a helper for testing | |
7 # configuration token that starts with a variable. | |
8 | |
9 ############################################################################### | |
10 | |
11 use warnings; | |
12 use strict; | |
13 | |
14 use Test::More; | |
15 | |
16 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
17 | |
18 use lib 'lib'; | |
19 use Test::Nginx; | |
20 | |
21 ############################################################################### | |
22 | |
23 select STDERR; $| = 1; | |
24 select STDOUT; $| = 1; | |
25 | |
26 my $t = Test::Nginx->new()->has(qw/http/) | |
27 ->write_file_expand('nginx.conf', <<'EOF'); | |
28 | |
29 %%TEST_GLOBALS%% | |
30 | |
31 daemon off; | |
32 | |
33 events { | |
34 } | |
35 | |
36 http { | |
37 %%TEST_GLOBALS_HTTP%% | |
38 | |
39 server { | |
40 listen 127.0.0.1:8080; | |
41 server_name localhost; | |
42 add_header X-URI $uri; | |
43 | |
44 location /var/ { | |
45 alias %%TESTDIR%%/; | |
46 index ${server_name}html; | |
47 } | |
48 } | |
49 } | |
50 | |
51 EOF | |
52 | |
53 $t->write_file('localhosthtml', 'varbody'); | |
54 | |
55 $t->try_run('unsupported token')->plan(1); | |
56 | |
57 ############################################################################### | |
58 | |
59 like(http_get('/var/'), qr/X-URI: \/var\/localhosthtml.*varbody/ms, 'var'); | |
60 | |
61 ############################################################################### |