Mercurial > hg > nginx-tests
comparison xslt.t @ 1493:829467f8d696
Tests: xslt_stylesheet parameter from variable.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 18 Jul 2019 19:11:55 +0300 |
parents | 882267679006 |
children | b4014b3e8495 |
comparison
equal
deleted
inserted
replaced
1492:760fdf2865bb | 1493:829467f8d696 |
---|---|
19 ############################################################################### | 19 ############################################################################### |
20 | 20 |
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 my $t = Test::Nginx->new()->has(qw/http xslt/)->plan(5); | 24 my $t = Test::Nginx->new()->has(qw/http xslt/)->plan(6); |
25 | 25 |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | 26 $t->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
53 xslt_stylesheet %%TESTDIR%%/test.xslt; | 53 xslt_stylesheet %%TESTDIR%%/test.xslt; |
54 } | 54 } |
55 location /x4 { | 55 location /x4 { |
56 xslt_stylesheet %%TESTDIR%%/first.xslt; | 56 xslt_stylesheet %%TESTDIR%%/first.xslt; |
57 xslt_stylesheet %%TESTDIR%%/test.xslt; | 57 xslt_stylesheet %%TESTDIR%%/test.xslt; |
58 } | |
59 location /x5 { | |
60 xslt_stylesheet %%TESTDIR%%/test.xslt | |
61 param1='$server_name'; | |
58 } | 62 } |
59 } | 63 } |
60 } | 64 } |
61 | 65 |
62 EOF | 66 EOF |
100 $t->write_file('entities.dtd', '<!ENTITY test "test entity">' . "\n"); | 104 $t->write_file('entities.dtd', '<!ENTITY test "test entity">' . "\n"); |
101 $t->write_file('x1', '<empty/>'); | 105 $t->write_file('x1', '<empty/>'); |
102 $t->write_file('x2', '<root>data</root>'); | 106 $t->write_file('x2', '<root>data</root>'); |
103 $t->write_file('x3', '<!DOCTYPE root><root>&test;</root>'); | 107 $t->write_file('x3', '<!DOCTYPE root><root>&test;</root>'); |
104 $t->write_file('x4', '<root>data</root>'); | 108 $t->write_file('x4', '<root>data</root>'); |
109 $t->write_file('x5', '<root>data</root>'); | |
105 | 110 |
106 $t->run(); | 111 $t->run(); |
107 | 112 |
108 ############################################################################### | 113 ############################################################################### |
109 | 114 |
112 like(http_get("/x2"), qr!200 OK.*param1=value1.*param2=data.*param3=value3!ms, | 117 like(http_get("/x2"), qr!200 OK.*param1=value1.*param2=data.*param3=value3!ms, |
113 'params'); | 118 'params'); |
114 like(http_get("/x3"), qr!200 OK.*data=test entity!ms, 'entities'); | 119 like(http_get("/x3"), qr!200 OK.*data=test entity!ms, 'entities'); |
115 like(http_get("/x4"), qr!200 OK.*data=other data!ms, 'several stylesheets'); | 120 like(http_get("/x4"), qr!200 OK.*data=other data!ms, 'several stylesheets'); |
116 | 121 |
122 TODO: { | |
123 todo_skip 'heap-buffer-overflow', 1 unless $t->has_version('1.17.2') | |
124 or $ENV{TEST_NGINX_UNSAFE}; | |
125 | |
126 like(http_get("/x5"), qr!200 OK.*param1=localhost!ms, 'params variable'); | |
127 | |
128 } | |
129 | |
117 ############################################################################### | 130 ############################################################################### |