File tree 1 file changed +65
-0
lines changed
1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+
3
+ # (C) Maxim Dounin
4
+
5
+ # Tests for nginx ssi module, waited subrequests.
6
+
7
+ # ##############################################################################
8
+
9
+ use warnings;
10
+ use strict;
11
+
12
+ use Test::More;
13
+
14
+ BEGIN { use FindBin; chdir ($FindBin::Bin ); }
15
+
16
+ use lib ' lib' ;
17
+ use Test::Nginx;
18
+
19
+ # ##############################################################################
20
+
21
+ select STDERR ; $| = 1;
22
+ select STDOUT ; $| = 1;
23
+
24
+ my $t = Test::Nginx-> new()-> has(qw/ http ssi/ )-> plan(2);
25
+
26
+ $t -> write_file_expand(' nginx.conf' , <<'EOF' );
27
+
28
+ %%TEST_GLOBALS%%
29
+
30
+ daemon off;
31
+
32
+ events {
33
+ }
34
+
35
+ http {
36
+ %%TEST_GLOBALS_HTTP%%
37
+
38
+ server {
39
+ listen 127.0.0.1:8080;
40
+ server_name localhost;
41
+ location / {
42
+ ssi on;
43
+ }
44
+ }
45
+ }
46
+
47
+ EOF
48
+
49
+ $t -> write_file(' test-stub.html' , ' <!--# block name="stub" -->STUB<!--# endblock -->' .
50
+ ' x<!--#include virtual="/empty.html" stub="stub" -->x' );
51
+
52
+ $t -> write_file(' test-concurrent.html' , ' x<!--#include virtual="/first.html" -->' .
53
+ ' <!--# block name="stub" -->STUB<!--# endblock -->' .
54
+ ' x<!--#include virtual="/empty.html" stub="stub" -->x' );
55
+ $t -> write_file(' first.html' , ' FIRST' );
56
+ $t -> write_file(' empty.html' , ' ' );
57
+
58
+ $t -> run();
59
+
60
+ # ##############################################################################
61
+
62
+ like(http_get(' /test-stub.html' ), qr / ^xSTUBx$ / m , ' stub' );
63
+ like(http_get(' /test-concurrent.html' ), qr / ^xFIRSTxSTUBx$ / m , ' concurrent' );
64
+
65
+ # ##############################################################################
You can’t perform that action at this time.
0 commit comments