Mercurial > hg > nginx-tests
comparison sub_filter_merge.t @ 703:62dad59cfb67
Tests: sub_filter inheritance test.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 21 Sep 2015 19:45:51 +0300 |
parents | |
children | 875f9c2528fc |
comparison
equal
deleted
inserted
replaced
702:cc2b98d028c8 | 703:62dad59cfb67 |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Sergey Kandaurov | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Test for sub_filter inheritance from http context. | |
7 | |
8 ############################################################################### | |
9 | |
10 use warnings; | |
11 use strict; | |
12 | |
13 use Test::More; | |
14 | |
15 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
16 | |
17 use lib 'lib'; | |
18 use Test::Nginx; | |
19 | |
20 ############################################################################### | |
21 | |
22 select STDERR; $| = 1; | |
23 select STDOUT; $| = 1; | |
24 | |
25 my $t = Test::Nginx->new()->has(qw/http sub/); | |
26 | |
27 plan(skip_all => 'leaves coredump') unless $ENV{TEST_NGINX_UNSAFE}; | |
28 | |
29 $t->plan(1)->write_file_expand('nginx.conf', <<'EOF'); | |
30 | |
31 %%TEST_GLOBALS%% | |
32 | |
33 daemon off; | |
34 | |
35 events { | |
36 } | |
37 | |
38 http { | |
39 %%TEST_GLOBALS_HTTP%% | |
40 | |
41 sub_filter foo bar; | |
42 | |
43 server { | |
44 listen 127.0.0.1:8080; | |
45 server_name localhost; | |
46 | |
47 location / { } | |
48 } | |
49 } | |
50 | |
51 EOF | |
52 | |
53 $t->write_file('foo.html', 'foo'); | |
54 $t->run(); | |
55 | |
56 ############################################################################### | |
57 | |
58 like(http_get('/foo.html'), qr/bar/, 'sub_filter inheritance'); | |
59 | |
60 ############################################################################### |