Mercurial > hg > nginx-tests
annotate sub_filter_merge.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 196d33c2bb45 |
children |
rev | line source |
---|---|
703
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Test for sub_filter inheritance from http context. |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http sub/); |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 $t->plan(1)->write_file_expand('nginx.conf', <<'EOF'); |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 events { |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 } |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 http { |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 sub_filter foo bar; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
42 listen 127.0.0.1:8080; |
703
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server_name localhost; |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 location / { } |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 } |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 } |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 EOF |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 $t->write_file('foo.html', 'foo'); |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 $t->run(); |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 ############################################################################### |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 like(http_get('/foo.html'), qr/bar/, 'sub_filter inheritance'); |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 |
62dad59cfb67
Tests: sub_filter inheritance test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 ############################################################################### |