Mercurial > hg > nginx-tests
comparison stream_js_variables.t @ 1614:bc0990ea2e5b
Tests: js TODO adjusted up to 0.4.0.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Tue, 17 Nov 2020 17:49:16 +0000 |
parents | f3ba4c74de31 |
children | 18ac4d9e5a2a |
comparison
equal
deleted
inserted
replaced
1613:d7ec131d305a | 1614:bc0990ea2e5b |
---|---|
21 ############################################################################### | 21 ############################################################################### |
22 | 22 |
23 select STDERR; $| = 1; | 23 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 my $t = Test::Nginx->new()->has(qw/http stream stream_return/) | 26 my $t = Test::Nginx->new()->has(qw/stream stream_return/) |
27 ->write_file_expand('nginx.conf', <<'EOF'); | 27 ->write_file_expand('nginx.conf', <<'EOF'); |
28 | 28 |
29 %%TEST_GLOBALS%% | 29 %%TEST_GLOBALS%% |
30 | 30 |
31 daemon off; | 31 daemon off; |
32 | 32 |
33 events { | 33 events { |
34 } | |
35 | |
36 http { | |
37 %%TEST_GLOBALS_HTTP%% | |
38 | |
39 js_include test.js; | |
40 | |
41 server { | |
42 listen 127.0.0.1:8080; | |
43 server_name localhost; | |
44 | |
45 location /njs { | |
46 js_content test_njs; | |
47 } | |
48 } | |
49 } | 34 } |
50 | 35 |
51 stream { | 36 stream { |
52 %%TEST_GLOBALS_STREAM%% | 37 %%TEST_GLOBALS_STREAM%% |
53 | 38 |
68 } | 53 } |
69 | 54 |
70 EOF | 55 EOF |
71 | 56 |
72 $t->write_file('test.js', <<EOF); | 57 $t->write_file('test.js', <<EOF); |
73 function test_njs(r) { | |
74 r.return(200, njs.version); | |
75 } | |
76 | |
77 function test_var(s) { | 58 function test_var(s) { |
78 s.variables.status = 400; | 59 s.variables.status = 400; |
79 return 'test_var'; | 60 return 'test_var'; |
80 } | 61 } |
81 | 62 |